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 989e56d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 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,14 @@ 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 totalPageCount = data?.articlesCount
? data.articlesCount / ARTICLE_PREVIEW_FETCH_LIMIT
: 0;

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

0 comments on commit 989e56d

Please sign in to comment.