diff --git a/src/drawer/pages/Provider/Provider.tsx b/src/drawer/pages/Provider/Provider.tsx index c29549b3..6fc2c914 100644 --- a/src/drawer/pages/Provider/Provider.tsx +++ b/src/drawer/pages/Provider/Provider.tsx @@ -6,7 +6,9 @@ import { RankingCategory } from '@/drawer/components/Category/RankingCategory'; import { EmptyScreen } from '@/drawer/components/EmptyScreen/EmptyScreen'; import { SMALL_DESKTOP_MEDIA_QUERY } from '@/drawer/constants/mobileview.constant'; import { useGetProductByProvider } from '@/drawer/hooks/useGetProductByProvider'; +import { ProviderProductResponses } from '@/drawer/types/product.type'; import { useMediaQuery } from '@/hooks/useMediaQuery'; +import { useScrollObserve } from '@/hooks/useScrollObserve'; import { StyledDescription, @@ -19,10 +21,16 @@ export const Provider = () => { const isSmallDesktop = useMediaQuery(SMALL_DESKTOP_MEDIA_QUERY); const { providerId } = useParams(); - - const { data } = useGetProductByProvider({ + const { data, isPending, fetchNextPage, hasNextPage } = useGetProductByProvider({ providerId: String(providerId), }); + const providerName = data.pages[0].providerName; + + const { lastElementRef } = useScrollObserve({ + isPending, + fetchNextPage, + hasNextPage, + }); return ( @@ -30,14 +38,21 @@ export const Provider = () => { {isSmallDesktop && }
- {data.providerName} + {providerName} 개발자의 서비스를 확인해보세요.
- {data.products.length > 0 ? ( - - ) : ( - - )} + {data.pages.map((page, index) => { + if (page.products.length === 0) { + return ; + } + + return ( +
+ +
+
+ ); + })} );