Skip to content

Commit

Permalink
fix(home): 홈 피드 영역에서 실제 데이터로 Pagination 을 구성하도록 함
Browse files Browse the repository at this point in the history
  • Loading branch information
innocarpe committed Sep 14, 2023
1 parent 03b9c96 commit 601f020
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/react-world/src/components/home/HomeFeedContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import PopularArticleTagList from './PopularArticleTagList';
import HomeFeedTab from './HomeFeedTab';
import Pagination from './Pagination';
import useArticlePreviewQuery from '../../quries/useArticlePreviewQuery';
import { ARTICLE_PREVIEW_FETCH_LIMIT } from '../../apis/article/ArticlePreviewService';

const HomeFeedContents = () => {
// TODO: Zustand Store 에서 초기값을 지정하고, 이후 현재 페이지 정보를 가지도록 구현 필요
const { data, isLoading } = useArticlePreviewQuery(1);
// const pageCount = data?.articlesCount / ARTICLE_PREVIEW_FETCH_LIMIT;
const totalPageCount = data?.articlesCount
? data.articlesCount / ARTICLE_PREVIEW_FETCH_LIMIT
: 0;

return (
<Container>
Expand All @@ -24,7 +29,7 @@ const HomeFeedContents = () => {
articlePreview={articlePreview}
/>
))}
<Pagination pages={[1, 2]} activePage={1} />
<Pagination totalPages={totalPageCount} activePageIndex={0} />
</>
)}
</div>
Expand Down

0 comments on commit 601f020

Please sign in to comment.