summaryrefslogtreecommitdiff
path: root/src/pages/index.jsx
diff options
context:
space:
mode:
authortri.susilo <tri.susilo@altama.co.id>2024-05-08 14:47:11 +0700
committertri.susilo <tri.susilo@altama.co.id>2024-05-08 14:47:11 +0700
commit6b173eaf8a95432316822b1d41b084875adfbd83 (patch)
treea979594bb1986c230f24566d2c79d8b6669ef3a9 /src/pages/index.jsx
parentd169ea22f8823f1bd9a94614ae2529677e0688ab (diff)
[agnes] - Feature category management
Diffstat (limited to 'src/pages/index.jsx')
-rw-r--r--src/pages/index.jsx22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index c097530c..9675c355 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -1,5 +1,5 @@
import dynamic from 'next/dynamic';
-import { useRef } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { HeroBannerSkeleton } from '@/components/skeleton/BannerSkeleton';
import { PopularProductSkeleton } from '@/components/skeleton/PopularProductSkeleton';
@@ -11,6 +11,9 @@ import { FlashSaleSkeleton } from '@/lib/flashSale/skeleton/FlashSaleSkeleton';
import PreferredBrandSkeleton from '@/lib/home/components/Skeleton/PreferredBrandSkeleton';
import PromotinProgram from '@/lib/promotinProgram/components/HomePage';
import PagePopupIformation from '~/modules/popup-information';
+import CategoryPilihan from '../lib/home/components/CategoryPilihan';
+import odooApi from '@/core/api/odooApi';
+import { getIdFromSlug } from '@/core/utils/slug'
const BasicLayout = dynamic(() =>
import('@/core/components/layouts/BasicLayout')
@@ -52,7 +55,7 @@ const CustomerReviews = dynamic(() =>
);
const ServiceList = dynamic(() => import('@/lib/home/components/ServiceList'));
-export default function Home() {
+export default function Home({categoryId}) {
const bannerRef = useRef(null);
const wrapperRef = useRef(null);
@@ -61,6 +64,18 @@ export default function Home() {
bannerRef.current?.querySelector(':first-child')?.clientHeight + 'px';
};
+ const [dataCategories, setDataCategories] = useState([])
+
+ useEffect(() => {
+ const loadCategories = async () => {
+ const getCategories = await odooApi('GET', '/api/v1/category/child?partner_id='+{categoryId})
+ if(getCategories){
+ setDataCategories(getCategories)
+ }
+ }
+ loadCategories()
+ }, [])
+
return (
<BasicLayout>
<Seo
@@ -104,7 +119,8 @@ export default function Home() {
</div>
<FlashSale />
<PromotinProgram />
- <CategoryHomeId />
+ <CategoryPilihan categories={dataCategories}/>
+ {/* <CategoryHomeId /> */}
<BannerSection />
<CustomerReviews />
</div>