diff --git a/core/api/community.ts b/core/api/community.ts index 918511f..282dd6a 100644 --- a/core/api/community.ts +++ b/core/api/community.ts @@ -14,7 +14,6 @@ export const useGetCommunityList = () => { const { data, error } = useSWR('/board', baseInstance.get, { errorRetryCount: 3, }); - console.log(`데이터 ${data}`); return { communityList: data, diff --git a/pages/community/index.tsx b/pages/community/index.tsx index aca0875..648a213 100644 --- a/pages/community/index.tsx +++ b/pages/community/index.tsx @@ -24,11 +24,13 @@ export default function community() { useGetCommunityList() as GetCommunityList; useEffect(() => { + console.log(communityList); if (communityList) { - let data = communityList as CommunityData[]; + let data = communityList.data as CommunityData[]; data = data.filter( (_, idx) => (currentPage - 1) * 10 <= idx && idx < currentPage * 10, ); + console.log(data); setContentList(data); window.scrollTo({ top: 0, @@ -36,6 +38,7 @@ export default function community() { }); } }, [contentList, currentPage]); + console.log(contentList); // setIsLoading(true); // fetch('/board') // .then((res) => res.json()) @@ -70,11 +73,13 @@ export default function community() { - + {!isLoading && !isError && communityList && ( + + )} )} diff --git a/types/community.ts b/types/community.ts index 9abba27..24c849e 100644 --- a/types/community.ts +++ b/types/community.ts @@ -35,7 +35,7 @@ export interface PostCommentBody { } export interface GetCommunityList { - communityList: CommunityData[]; + communityList: { data: CommunityData[] }; isLoading: boolean; isError: string; }