summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-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>