diff --git a/frontend/app/(WithNavbar)/interview/[generation]/page.tsx b/frontend/app/(WithNavbar)/interview/[generation]/page.tsx index f8a98a08..3d04b063 100644 --- a/frontend/app/(WithNavbar)/interview/[generation]/page.tsx +++ b/frontend/app/(WithNavbar)/interview/[generation]/page.tsx @@ -17,7 +17,7 @@ const InterviewPage = ({ params: { generation } }: InterviewPageProps) => { - + ); diff --git a/frontend/components/interview/Board.tsx b/frontend/components/interview/Board.tsx index c9af9f3f..d816f0fc 100644 --- a/frontend/components/interview/Board.tsx +++ b/frontend/components/interview/Board.tsx @@ -11,7 +11,11 @@ import { getInterviewRecordByPageWithOrder } from "@/src/apis/interview"; import { ORDER_MENU } from "@/src/constants"; import { useSearchQuery } from "@/src/hooks/useSearchQuery"; -const InterviewBoard = () => { +interface InterviewBoardProps { + generation: string; +} + +const InterviewBoard = ({ generation }: InterviewBoardProps) => { const [applicantId, setApplicantId] = useAtom(interViewApplicantIdState); const searchParams = useSearchParams(); const pageIndex = searchParams.get("page") || "1"; @@ -31,8 +35,13 @@ const InterviewBoard = () => { }; const { data, isLoading } = useQuery({ - queryKey: ["allInterviewRecord", pageIndex, order], - queryFn: () => getInterviewRecordByPageWithOrder(+pageIndex, order), + queryKey: ["allInterviewRecord", pageIndex, order, generation], + queryFn: () => + getInterviewRecordByPageWithOrder({ + page: +pageIndex, + sortType: order, + year: generation, + }), }); if (!data || isLoading) { diff --git a/frontend/components/interview/PageNavbar.tsx b/frontend/components/interview/PageNavbar.tsx index 2b9f23ca..2e3fe174 100644 --- a/frontend/components/interview/PageNavbar.tsx +++ b/frontend/components/interview/PageNavbar.tsx @@ -29,8 +29,13 @@ const InterviewPageNavbar = ({ generation }: InterviewPageNavbarProps) => { isLoading, isError, } = useQuery( - ["allApplicant", generation], - () => getInterviewRecordByPageWithOrder(+pageIndex, order), + ["allApplicant", order, generation], + () => + getInterviewRecordByPageWithOrder({ + page: +pageIndex, + sortType: order, + year: generation, + }), { enabled: !!generation, } diff --git a/frontend/src/apis/interview/index.ts b/frontend/src/apis/interview/index.ts index e7fbd4fc..a52e17c1 100644 --- a/frontend/src/apis/interview/index.ts +++ b/frontend/src/apis/interview/index.ts @@ -19,14 +19,20 @@ interface RecordsByPageRes { pageInfo: PageInfo; } -export const getInterviewRecordByPageWithOrder = async ( - page: number, - order: string -) => { +interface GetInterviewRecordByPageWithOrderReq { + page: number; + sortType: string; + year: string; +} + +export const getInterviewRecordByPageWithOrder = async ({ + page, + ...queryParams +}: GetInterviewRecordByPageWithOrderReq) => { const { data: { records, pageInfo }, } = await https.get( - `/page/${page}/records?sortType=${order}` + `/page/${page}/records?${new URLSearchParams(queryParams)}` ); return {