From 49198fed8da2ab476bebc2233907063b02de0d66 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 31 Jan 2023 16:21:33 +0700 Subject: Product slider categories home page --- src/pages/index.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/pages') diff --git a/src/pages/index.js b/src/pages/index.js index 35175dce..8c636616 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -27,6 +27,7 @@ export default function Home({ heroBanners }) { const [manufactures, setManufactures] = useState(null); const [readyStockProducts, setReadyStockProducts] = useState(null); const [popularProducts, setPopularProducts] = useState(null); + const [categoryProducts, setCategoryProducts] = useState(null); useEffect(() => { const getManufactures = async () => { @@ -46,6 +47,12 @@ export default function Home({ heroBanners }) { setPopularProducts(dataPopularProducts.data.response); } getPopularProducts(); + + const getCategoryProducts = async () => { + const dataCategoryProducts = await apiOdoo('GET', '/api/v1/categories_homepage'); + setCategoryProducts(dataCategoryProducts); + } + getCategoryProducts(); }, []); return ( @@ -77,14 +84,19 @@ export default function Home({ heroBanners }) { } -
+

Produk Populer

-
-

Produk Ready Stock

- -
+ + { categoryProducts?.map((categoryProduct) => ( +
+ +
+ )) }
Platform Belanja B2B Alat Teknik & Industri di Indonesia
-- cgit v1.2.3