diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 11:03:58 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 11:03:58 +0700 |
| commit | a20fd43f0cafe86444605c3bb8f2a998e1b9dbe6 (patch) | |
| tree | a47dce9b427a3aea1c2429c9ebfaa45f094b8c57 /src/lib/product/components/ProductSearch.jsx | |
| parent | 6d3b7a1744b6be3474f52ee3e0270963ecadd24b (diff) | |
<iman> update link lihat semua non display voucher
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
| -rw-r--r-- | src/lib/product/components/ProductSearch.jsx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index fb9017f4..09727e81 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -40,6 +40,24 @@ const ProductSearch = ({ const [limit, setLimit] = useState(query?.limit || 30); const [orderBy, setOrderBy] = useState(router.query?.orderBy); if (defaultBrand) query.brand = defaultBrand.toLowerCase(); + + useEffect(() => { + const checkIfPenawaran = async () => { + if (router.asPath.includes('penawaran')) { + query = { + ...query, + fq: [ + `-flashsale_id_i:${router.query.penawaran}`, + `flashsale_price_f:[1 TO *]` + ], + orderBy: 'flashsale-discount-desc' + }; + setOrderBy('flashsale-discount-desc') + } + }; + checkIfPenawaran(); + }, [router]); + const { productSearch } = useProductSearch({ query: { ...query, q, limit, orderBy }, operation: 'AND', |
