diff --git a/src/app/page.tsx b/src/app/page.tsx index caf61734..98ac767b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,10 +1,13 @@ +/* eslint-disable react/no-array-index-key */ /* eslint-disable @typescript-eslint/no-unused-vars */ 'use client'; +import InfiniteScroll from 'react-infinite-scroll-component'; + import classNames from 'classnames/bind'; -import { MOCK_BANNER_DATA, MOCK_PRODUCT_LIST, MOCK_RECOMMEND_PRODUCTS } from '@mocks/homeHandler/mocks'; +import { MOCK_BANNER_DATA, MOCK_RECOMMEND_PRODUCTS } from '@mocks/homeHandler/mocks'; import useBanner from '@remote/queries/home/useBanner'; import useProductList from '@remote/queries/home/useProductList'; import useRecommendProducts from '@remote/queries/home/useRecommendProducts'; @@ -38,6 +41,10 @@ function Home() { // return ; // } + const { + data: productList, isLoading, hasNextPage, loadMore, isFetching, + } = useProductList(); + return ( <>
@@ -52,7 +59,7 @@ function Home() {
- WashPedia 랭킹 + WashFit 랭킹 @@ -61,12 +68,19 @@ function Home() { -
- {MOCK_PRODUCT_LIST?.value.map((item) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - return ; - })} -
+ Loading ...
} + inverse={false} + > +
+ {productList?.map((item, index) => { + return ; + })} +
+ diff --git a/src/remote/api/requests/home/home.get.api.ts b/src/remote/api/requests/home/home.get.api.ts index fcbd6c57..6cfbe865 100644 --- a/src/remote/api/requests/home/home.get.api.ts +++ b/src/remote/api/requests/home/home.get.api.ts @@ -1,5 +1,5 @@ import { - BannerType, ProductType, RecommendProductsType, + BannerType, ProductListInfoType, RecommendProductsType, } from '../../types/home'; import { getRequest } from '../requests.api'; @@ -18,8 +18,8 @@ export const getRecommendProducts = async () => { }; /* ----- 제품 목록 정보 api ----- */ -export const getProductList = async () => { - const response = await getRequest('/products?sortType=viewcnt_order'); +export const getProductList = async (pageNum: number, size: number) => { + const response = await getRequest(`/products/rank?sortType=recent-order&page=${pageNum}&size=${size}`); return response; };