Skip to content

Commit

Permalink
feat: 면접자 조회 API 쿼리 파라미터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
2yunseong committed Sep 10, 2024
1 parent d32ae1b commit 8a22e05
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/app/(WithNavbar)/interview/[generation]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const InterviewPage = ({ params: { generation } }: InterviewPageProps) => {
<Search />
<SortList sortList={ORDER_MENU.INTERVIEW} />
</div>
<InterviewBoard />
<InterviewBoard generation={generation} />
<InterviewPageNavbar generation={generation} />
</div>
);
Expand Down
11 changes: 8 additions & 3 deletions frontend/components/interview/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -31,8 +35,9 @@ const InterviewBoard = () => {
};

const { data, isLoading } = useQuery({
queryKey: ["allInterviewRecord", pageIndex, order],
queryFn: () => getInterviewRecordByPageWithOrder(+pageIndex, order),
queryKey: ["allInterviewRecord", pageIndex, order, generation],
queryFn: () =>
getInterviewRecordByPageWithOrder(+pageIndex, order, generation),
});

if (!data || isLoading) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/interview/PageNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const InterviewPageNavbar = ({ generation }: InterviewPageNavbarProps) => {
isLoading,
isError,
} = useQuery(
["allApplicant", generation],
() => getInterviewRecordByPageWithOrder(+pageIndex, order),
["allApplicant", order, generation],
() => getInterviewRecordByPageWithOrder(+pageIndex, order, generation),
{
enabled: !!generation,
}
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/apis/interview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ interface RecordsByPageRes {

export const getInterviewRecordByPageWithOrder = async (
page: number,
order: string
order: string,
year: string
) => {
const sq = new URLSearchParams({ sortType: order, year });
const {
data: { records, pageInfo },
} = await https.get<RecordsByPageRes>(
`/page/${page}/records?sortType=${order}`
`/page/${page}/records?${sq.toString()}`
);

return {
Expand Down

0 comments on commit 8a22e05

Please sign in to comment.