diff --git a/apps/common/features/src/shared/model/api-interface.ts b/apps/common/features/src/shared/model/api-interface.ts index 133c0c401..8218bfb0d 100644 --- a/apps/common/features/src/shared/model/api-interface.ts +++ b/apps/common/features/src/shared/model/api-interface.ts @@ -30,5 +30,5 @@ export interface PageableList { export interface PageableParams { page?: number; size?: number; - sort?: string[]; + sort?: string; } diff --git a/apps/common/features/src/widgets/post/ui/post-page.tsx b/apps/common/features/src/widgets/post/ui/post-page.tsx index 3e7d74f04..5a459835f 100644 --- a/apps/common/features/src/widgets/post/ui/post-page.tsx +++ b/apps/common/features/src/widgets/post/ui/post-page.tsx @@ -42,6 +42,7 @@ function PostPage({ bbsId }: { bbsId: string }) { const { bbsInfo, pageMenuAuthority } = useMenuStore((state) => state); const thumbRefs = useRef>(new Map()); + const [tableSort, setTableSort] = useState(""); const [postParams, setPostParams] = useState({ keywordType: "title", keyword: "", @@ -77,13 +78,14 @@ function PostPage({ bbsId }: { bbsId: string }) { isLoading, refetch, } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pagination], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pagination, tableSort], queryFn: () => PostApi.getPostList(parseInt(bbsId), { ...postParams, ansUseYn: bbsInfo?.ansUseYn, page: pagination.pageIndex, size: pagination.pageSize, + sort: tableSort, }), }); @@ -201,6 +203,24 @@ function PostPage({ bbsId }: { bbsId: string }) { ))} + diff --git a/apps/cs/src/widgets/post/ui/post-page.tsx b/apps/cs/src/widgets/post/ui/post-page.tsx index af4a01fc7..a37cdec84 100644 --- a/apps/cs/src/widgets/post/ui/post-page.tsx +++ b/apps/cs/src/widgets/post/ui/post-page.tsx @@ -46,6 +46,7 @@ function PostPage({ bbsId }: { bbsId: string }) { const bbsInfo = useMenuStore((state) => state.bbsInfo); const thumbRefs = useRef>(new Map()); + const [tableSort, setTableSort] = useState(""); const [postParams, setPostParams] = useState({ keywordType: "title", keyword: "", @@ -78,7 +79,12 @@ function PostPage({ bbsId }: { bbsId: string }) { isLoading, refetch, } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd, pagination], + queryKey: [ + ENDPOINT.BOARD_SERVICE.POSTS, + bbsInfo?.bbsTypeCd, + pagination, + tableSort, + ], queryFn: () => PostApi.getPostList(parseInt(bbsId), { ...postParams, @@ -86,6 +92,7 @@ function PostPage({ bbsId }: { bbsId: string }) { ansUseYn: bbsInfo?.ansUseYn, page: pagination.pageIndex, size: pagination.pageSize, + sort: tableSort, }), enabled: !!bbsInfo?.bbsTypeCd, }); @@ -205,6 +212,24 @@ function PostPage({ bbsId }: { bbsId: string }) { ))} +