-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1354 from 42organization/feat/1353-feat-임시-결과-등록-…
…모달-추가 [Feat] 임시 결과 등록 모달 추가
- Loading branch information
Showing
4 changed files
with
169 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { useSetRecoilState } from 'recoil'; | ||
import { instanceInManage } from 'utils/axios'; | ||
import { toastState } from 'utils/recoil/toast'; | ||
import styles from 'styles/admin/modal/AdminRecruitMessageTemplateModal.module.scss'; | ||
|
||
function AdminRecruitResultModal({ | ||
recruitId, | ||
applicationId, | ||
status, | ||
interviewDate, | ||
}: { | ||
recruitId: number; | ||
applicationId: number; | ||
status: 'PROGRESS_INTERVIEW' | 'FAIL' | 'PASS'; | ||
interviewDate: Date | null; | ||
}) { | ||
const setSnackbar = useSetRecoilState(toastState); | ||
const sendInterviewResult = async () => { | ||
try { | ||
// send interview result to server | ||
await instanceInManage.post( | ||
`/admin/recruitments/${recruitId}/interview?application=${applicationId}`, | ||
{ | ||
status, | ||
interviewDate, | ||
} | ||
); | ||
setSnackbar({ | ||
toastName: 'interviewResult', | ||
severity: 'success', | ||
message: '면접 결과가 성공적으로 등록되었습니다.', | ||
clicked: true, | ||
}); | ||
} catch (e) { | ||
setSnackbar({ | ||
toastName: 'interviewResult', | ||
severity: 'error', | ||
message: '면접 결과 등록에 실패했습니다.', | ||
clicked: true, | ||
}); | ||
} | ||
}; | ||
|
||
const sendFinalResult = async () => { | ||
try { | ||
// send final result to server | ||
await instanceInManage.post( | ||
`/admin/recruitments/${recruitId}/result?application=${applicationId}`, | ||
{ | ||
status, | ||
} | ||
); | ||
setSnackbar({ | ||
toastName: 'finalResult', | ||
severity: 'success', | ||
message: '최종 결과가 성공적으로 등록되었습니다.', | ||
clicked: true, | ||
}); | ||
} catch (e) { | ||
setSnackbar({ | ||
toastName: 'finalResult', | ||
severity: 'error', | ||
message: '최종 결과 등록에 실패했습니다.', | ||
clicked: true, | ||
}); | ||
} | ||
}; | ||
if (status === 'PROGRESS_INTERVIEW' && interviewDate) { | ||
return ( | ||
<div className={styles.container}> | ||
<button onClick={sendInterviewResult}>면접 결과 등록</button> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<button onClick={sendFinalResult}>최종 결과 등록</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default AdminRecruitResultModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters