From 5e2a8d315fa0bc58a18d4df5a995e402388995c9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 22 Aug 2024 13:10:29 +0700 Subject: update category dropdown --- src/lib/category/components/Category.jsx | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'src/lib/category/components/Category.jsx') diff --git a/src/lib/category/components/Category.jsx b/src/lib/category/components/Category.jsx index 374cdf78..f76e6e42 100644 --- a/src/lib/category/components/Category.jsx +++ b/src/lib/category/components/Category.jsx @@ -15,7 +15,6 @@ const Category = () => { const [banner, setBanner] = useState([]); const promotionProgram = useQuery('banner-promo-category-card', bannerApi({ type: 'banner-promo-category-card' })); - // const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); useEffect(() => { const loadCategories = async () => { @@ -36,28 +35,6 @@ const Category = () => { } loadCategories() }, []) - - // useEffect(() => { - // const loadCategories = async () => { - // let dataCategories = await odooApi('GET', '/api/v1/category/tree') - // dataCategories = dataCategories?.map((category) => { - // category.childs = category.childs.map((child1Category) => { - // return { - // ...child1Category, - // isOpen: false - // } - // }) - // return { - // ...category, - // isOpen: false - // } - // }) - // setCategories(dataCategories) - // } - // loadCategories() - // }, []) - // console.log("categories",categories) - return (
@@ -67,8 +44,8 @@ const Category = () => { href={createSlug('/shop/category/', category.name, category.id)} className='category-mega-box__parent flex items-center' > -
- +
+
{category.name} @@ -111,9 +88,8 @@ const Category = () => {
- {promotionProgram?.data[0]?.map((banner, index)=>( + {Array.isArray(promotionProgram?.data) && promotionProgram?.data.length > 0 && promotionProgram?.data[0]?.map((banner, index) => (
- {/* */} {`${banner.name}`}
))} -- cgit v1.2.3