Skip to content

Commit b5c5f42

Browse files
committed
2 parents 12a8d9a + 70b4d40 commit b5c5f42

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/pages/home/HomePage.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import { useEffect, useState } from "react";
1111
import { useSetOnlineStatus } from "../../hooks/useSetOnlineStatus";
1212
import HomePageSkeleton from "../../components/loading/home/HomePageSkeleton";
1313
import Button from "../../components/Button";
14+
import { usePostsStore } from "../../stores/postsStore";
1415

1516
export default function HomePage() {
1617
const currentUserId = useProfileStore((state) => state.currentUserId);
1718
const loading = useProfileStore((state) => state.loading);
1819
const fetchProfile = useProfileStore((state) => state.fetchProfile);
20+
const posts = usePostsStore((state) => state.posts);
21+
const fetchPosts = usePostsStore((state) => state.fetchPosts);
1922

2023
// 그룹 상태 관리
2124
const {
@@ -47,6 +50,11 @@ export default function HomePage() {
4750
}
4851
};
4952

53+
// 전체 게시글
54+
useEffect(() => {
55+
fetchPosts("all");
56+
}, [fetchPosts]);
57+
5058
// 시간 포맷팅 함수
5159
const formatTimeAgo = (dateString: string): string => {
5260
const now = new Date();
@@ -151,10 +159,7 @@ export default function HomePage() {
151159
<p className="text-sm">
152160
질문과 답변, 학습 팁, 경험담을 나누는 공간
153161
</p>
154-
<p className="text-xs">
155-
게시글 120개 · 최근 글 2시간 전 · 💬 8개 · ❤️
156-
15개
157-
</p>
162+
<p className="text-xs">게시글 {posts.length}</p>
158163
</div>
159164
<div className="flex flex-row gap-2 text-xs text-[#8B5CF6]">
160165
{/* 반복 함수 구현 예정 */}

0 commit comments

Comments
 (0)