Skip to content

Commit

Permalink
refactor: 불필요하게applicants에 조건문을 사용하던 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
geongyu09 committed Sep 16, 2024
1 parent c522277 commit 836ca3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
11 changes: 5 additions & 6 deletions frontend/components/passState/ApplicantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ const ApplicantsList = ({ sortedBy }: ApplicantsListProps) => {

const onChangeApplicantsPassState = (
applicantName: string,
params: {
applicantsId: string;
afterState: "pass" | "non-pass";
}
params: PostApplicantPassStateParams
) => {
const ok = confirm(
`${applicantName}님을 ${params.afterState} 처리하시겠습니까?`
Expand All @@ -98,8 +95,10 @@ const ApplicantsList = ({ sortedBy }: ApplicantsListProps) => {
updateApplicantPassState(params);
};

let applicants = allApplicants;
if (sortedBy === "field") applicants = sortApplicantsByField1(applicants);
const applicants =
sortedBy === "field"
? sortApplicantsByField1(allApplicants)
: allApplicants;

return (
<ul className="flex flex-col gap-4">
Expand Down
12 changes: 3 additions & 9 deletions frontend/src/apis/passState/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,6 @@ const _mock: Answer[] = [
},
];

export const getApplicantByIdWithField = ({
applicantsId,
afterState,
}: {
applicantsId: string;
afterState: "non-pass" | "pass";
}) => `/applicants/${applicantsId}/state?afterState=${afterState}`;

export const getAllApplicantsWithPassState = async (generation: string) => {
// TODO: 머지 하기 전 주석 해제 및 목데이터 삭제
// const { data } = await https.get<Answer[]>(
Expand All @@ -233,5 +225,7 @@ export const postApplicantPassState = async ({
afterState,
applicantsId,
}: PostApplicantPassStateParams) => {
await https.post(getApplicantByIdWithField({ applicantsId, afterState }));
await https.post(
`/applicants/${applicantsId}/state?afterState=${afterState}`
);
};
1 change: 0 additions & 1 deletion frontend/src/constants/passState/index.ts

This file was deleted.

0 comments on commit 836ca3d

Please sign in to comment.