diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 03:25:33 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 03:25:33 +0000 |
| commit | 8b12b43c0c3f9dd2d2743c83c23ed2a3f30fdae0 (patch) | |
| tree | 6ce4958f4000e3db72ceddebe7ffb468eefe395b /src/lib/product/api | |
| parent | 74b4e3a9b86f1d3b102ad3f907237f7da1b05009 (diff) | |
| parent | bda91439b6ef4605a579bde8bef603b551aab3dd (diff) | |
Merged in Feature/popup_cart (pull request #73)
Feature/popup cart
Diffstat (limited to 'src/lib/product/api')
| -rw-r--r-- | src/lib/product/api/productSimilarApi.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/product/api/productSimilarApi.js b/src/lib/product/api/productSimilarApi.js index c1bccd59..a008ce5d 100644 --- a/src/lib/product/api/productSimilarApi.js +++ b/src/lib/product/api/productSimilarApi.js @@ -21,10 +21,14 @@ const productSimilarApi = async ({ query, source }) => { const dataProductSimilar = await axios( `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=${query}&page=1&orderBy=popular-weekly&operation=OR` ) - dataProductSimilar.data.response.products = [ - ...dataflashSale, - ...dataProductSimilar.data.response.products, - ]; + if (dataflashSale) { + dataProductSimilar.data.response.products = [ + ...dataflashSale, + ...dataProductSimilar.data.response.products + ] + } else { + dataProductSimilar.data.response.products = [...dataProductSimilar.data.response.products] + } return dataProductSimilar.data.response } |
