From 0a1413aec32fddc433a34bf7d03d8681dedc266d Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Mon, 30 Oct 2023 09:30:25 +0700
Subject: show brand logo in page search if search is brand

---
 src/lib/product/components/ProductSearch.jsx | 9 ++-------
 1 file changed, 2 insertions(+), 7 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 50936d9a..190d026b 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -86,13 +86,8 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null })
       const brand = await axios(
         `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=search&q=${q}`
       )
-      if (brand.data.length > 0) {
-        brand.data.map((brand) => {
-          if (brand.name.toLowerCase() === q.toLowerCase()) {
-            setIsBrand(brand)
-          }
-        })
-      }
+      setIsBrand(brand?.data[0])
+     
     }
     checkIfBrand()
   }, [q])
-- 
cgit v1.2.3

