From 3c6c2a888e3ab27b4d5eead34104fd142f82b1ff Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 19 Aug 2024 14:53:22 +0700
Subject: <iman> update order by non flash display

---
 src/lib/product/components/ProductSearch.jsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductSearch.jsx')

diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index b799d533..f8b44529 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -53,6 +53,8 @@ const ProductSearch = ({
   if (defaultBrand) query.brand = defaultBrand.toLowerCase();
   const dataIdCategories = []
 
+  console.log('data',router)
+
   useEffect(() => {
     const checkIfPenawaran = async () => {
       if (router.asPath.includes('penawaran')) {
@@ -64,11 +66,13 @@ const ProductSearch = ({
           ],
           orderBy: 'flashsale-discount-desc'
         };
+        console.log('setOrder')
         setOrderBy('flashsale-discount-desc')
+        console.log('orderBy',orderBy)
       }
     };
     checkIfPenawaran();
-  }, [router]);
+  }, [router.query, prefixUrl, q, finalQuery, queryFinal]);
   
   useEffect(() => {
     if(prefixUrl.includes('category')){
@@ -156,9 +160,10 @@ const ProductSearch = ({
     if (prefixUrl.includes('category') || prefixUrl.includes('lob')) {
       setQueryFinal({ ...finalQuery, q, limit, orderBy });
     } else {
+      console.log("data query",orderBy)
       setQueryFinal({ ...query, q, limit, orderBy });
     }
-  }, [prefixUrl,dataCategoriesProduct, query, finalQuery]);
+  }, [prefixUrl,dataCategoriesProduct, query, finalQuery, orderBy]);
 
 
   const { productSearch } = useProductSearch({
-- 
cgit v1.2.3

