summaryrefslogtreecommitdiff
path: root/src/pages/shop
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-06-14 17:08:42 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-06-14 17:08:42 +0700
commit55f4e2dc6e25dd425ad0a2b8763f8b8de0305e70 (patch)
tree038bb429b66f01edff40708839c371c2a05c8d79 /src/pages/shop
parent518a2d89d91775ceffd06f8d7aca7050526310da (diff)
<iman> update promotion-program
Diffstat (limited to 'src/pages/shop')
-rw-r--r--src/pages/shop/promo/[slug].tsx18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/pages/shop/promo/[slug].tsx b/src/pages/shop/promo/[slug].tsx
index c53bcf0e..1248ba35 100644
--- a/src/pages/shop/promo/[slug].tsx
+++ b/src/pages/shop/promo/[slug].tsx
@@ -45,17 +45,26 @@ export default function PromoDetail() {
const popup = useActive();
useEffect(() => {
- // Initialize brandValues based on router.query.brand
if (router.query.brand) {
- const brandsArray = Array.isArray(router.query.brand) ? router.query.brand : [router.query.brand];
+ let brandsArray: string[] = [];
+ if (Array.isArray(router.query.brand)) {
+ brandsArray = router.query.brand;
+ } else if (typeof router.query.brand === 'string') {
+ brandsArray = router.query.brand.split(',').map((brand) => brand.trim());
+ }
setBrandValues(brandsArray);
} else {
setBrandValues([]);
}
- // Initialize categoryValues based on router.query.category
if (router.query.category) {
- const categoriesArray = Array.isArray(router.query.category) ? router.query.category : [router.query.category];
+ let categoriesArray: string[] = [];
+
+ if (Array.isArray(router.query.category)) {
+ categoriesArray = router.query.category;
+ } else if (typeof router.query.category === 'string') {
+ categoriesArray = router.query.category.split(',').map((category) => category.trim());
+ }
setCategoryValues(categoriesArray);
} else {
setCategoryValues([]);
@@ -467,6 +476,7 @@ const FilterChoicesComponent = ({
/>
</Tag>
))}
+ {console.log("categoryValues",categoryValues)}
{priceFrom && priceTo && (
<Tag size='lg' borderRadius='lg' variant='outline' colorScheme='gray'>
<TagLabel>