diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 14:02:10 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 14:02:10 +0700 |
| commit | 76e798e1266c1d888a97c6f866ae782dd6f0045f (patch) | |
| tree | ea95183fed1ebf15b153e994972abe882b7e4ff5 /src/lib | |
| parent | 5fb7f3fe3488e9d1b4885d9c5ad9720032babb54 (diff) | |
<iman> update position code
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/product/components/ProductSearch.jsx | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 07398795..b799d533 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -52,6 +52,24 @@ const ProductSearch = ({ const [orderBy, setOrderBy] = useState(router.query?.orderBy); if (defaultBrand) query.brand = defaultBrand.toLowerCase(); const dataIdCategories = [] + + 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]); + useEffect(() => { if(prefixUrl.includes('category')){ const loadProduct = async () => { @@ -142,22 +160,6 @@ const ProductSearch = ({ } }, [prefixUrl,dataCategoriesProduct, query, finalQuery]); - 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: queryFinal, |
