From 4723d90658b301ef70b1e1205c2b7a1d3dc387f3 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 2 Jul 2025 09:54:19 +0900 Subject: [PATCH] =?UTF-8?q?[common/features,=20apps/cs]=20feat:=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=A0=95=EB=A0=AC=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/shared/model/api-interface.ts | 2 +- .../src/widgets/post/ui/post-page.tsx | 22 ++++++++++++++- apps/cs/src/widgets/post/ui/post-page.tsx | 27 ++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) 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 }) { ))} +