File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,11 +11,14 @@ import { useEffect, useState } from "react";
1111import { useSetOnlineStatus } from "../../hooks/useSetOnlineStatus" ;
1212import HomePageSkeleton from "../../components/loading/home/HomePageSkeleton" ;
1313import Button from "../../components/Button" ;
14+ import { usePostsStore } from "../../stores/postsStore" ;
1415
1516export 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 { /* 반복 함수 구현 예정 */ }
You can’t perform that action at this time.
0 commit comments