From 87a004c0fcf256e1e92653767a630c01ad21ad5a Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Sat, 18 Nov 2023 11:33:28 +0700 Subject: add brand link di page search --- src/lib/product/components/ProductSearch.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index a4e9ecbb..29bb987e 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -20,6 +20,7 @@ import odooApi from '@/core/api/odooApi' import { formatCurrency } from '@/core/utils/formatValue' import axios from 'axios' import Skeleton from 'react-loading-skeleton' +import { createSlug } from '@/core/utils/slug' const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null }) => { const router = useRouter() @@ -87,13 +88,16 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null }) const brand = await axios( `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=search&q=${search}` ) + console.log('ini brand', brand) if (brand.data.length > 0) { setIsBrand(brand?.data[0]) } else { setIsBrand(null) } } - checkIfBrand() + if (router.pathname.includes('search')) { + checkIfBrand() + } }, [q]) const brands = [] @@ -362,11 +366,12 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null }) {isBrand && isBrand.logo && (

Brand Pencarian {q}

- + + +
)} -- cgit v1.2.3