Skip to content

Commit 519d031

Browse files
committed
fix: UserPostSummary로 수정
1 parent 91f0de6 commit 519d031

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/pages/MyPage/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import photo from '../../assets/default/photo.svg';
2727
import UserProfile from '../../components/UserProfile';
2828

2929
import { getUserPostListApi } from "../../apis/post";
30-
import { GetUserPostListData } from "../../apis/post/dto";
30+
import { UserPostSummary } from "../../apis/post/dto";
3131

3232
const MyPage: React.FC = () => {
3333
const [isLoading, setIsLoading] = useState(true);
3434
const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false);
35-
const [posts, setPosts] = useState<GetUserPostListData['post']>([]);
35+
const [posts, setPosts] = useState<UserPostSummary[]>([]);
3636
const [totalPosts, setTotalPosts] = useState(0);
3737
const navigate = useNavigate();
3838

@@ -75,19 +75,19 @@ const MyPage: React.FC = () => {
7575
// 게시물 리스트 조회 API
7676
const fetchPostList = async () => {
7777
try {
78-
const storedUserId = localStorage.getItem('my_id'); // localStorage에서 userId 가져오기
78+
const storedUserId = localStorage.getItem('my_id');
7979
if (!storedUserId) {
8080
console.error('User ID not found in localStorage');
8181
return;
8282
}
8383

84-
const response = await getUserPostListApi(1, 10, Number(storedUserId)); // API 호출
84+
const response = await getUserPostListApi(1, 10, Number(storedUserId));
8585
const { post, totalPostsCount } = response.data;
8686

87-
setPosts(post); // 게시물 목록 상태 업데이트
87+
setPosts(post); // 게시물 목록 상태 업데이트 (UserPostSummary 사용!)
8888
setTotalPosts(totalPostsCount); // 총 게시물 수 상태 업데이트
8989
} catch (error) {
90-
console.error('Error fetching user post list:', error); // 에러 로그 출력
90+
console.error('Error fetching user post list:', error);
9191
} finally {
9292
setIsLoading(false); // 로딩 상태 종료
9393
}

0 commit comments

Comments
 (0)