summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductSearch.jsx
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-12-05 02:59:30 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-12-05 02:59:30 +0000
commit80caa8f6ad5fecc213fd1533b972c6173102721e (patch)
treef70c8ec03cf2a1cdb8eb3f30ecd83e200986b70b /src/lib/product/components/ProductSearch.jsx
parenteca358fd93f1ea5d88c6a6fcc315624cc3bbb910 (diff)
parent4ac372ff318ee78e5d5019a1dbe95bf47b661766 (diff)
Merged in Feature/popup_information (pull request #118)
Feature/popup information
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
-rw-r--r--src/lib/product/components/ProductSearch.jsx17
1 files changed, 11 insertions, 6 deletions
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 && (
<div className='mb-3'>
<h1 className='text-2xl mb-2 font-semibold'>Brand Pencarian {q}</h1>
- <Image
- src={isBrand?.logo}
- alt=''
- className='object-cover object-center h-[100px]'
- />
+ <Link
+ href={createSlug('/shop/brands/', isBrand.name, isBrand.id)}
+ className='inline'
+ >
+ <Image src={isBrand?.logo} alt='' className='object-cover object-center h-24' />
+ </Link>
</div>
)}