Skip to content

Commit

Permalink
✨ feat: 최종 서류 작성 완료하기 api 연결 #127
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMirror21 committed Nov 25, 2024
1 parent 7b162ad commit 5b8f05b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export const patchInterviewFinish = async (id: number) => {
return response.data;
};

// 6.12 (유학생) 서류 작성 완료하기
export const patchWritingDocumentFinish = async (id: number) => {
const response = await api.patch(
`/users/user-owner-job-postings/${id}/step-filling-out-documents`,
);
return response.data;
};

// 6.13 (유학생) 유학생 담당자 검토 완료
export const patchContactCoordinator = async (id: number) => {
const response = await api.patch(
Expand Down
15 changes: 15 additions & 0 deletions src/hooks/api/useApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
patchContactCoordinator,
patchApplyHiKorea,
patchHiKoreaResult,
patchWritingDocumentFinish,
} from '@/api/application';
import { useMutation, useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -99,6 +100,20 @@ export const usePatchInterviewFinish = () => {
});
};

// 6.12 (유학생) 서류 작성 완료하기 훅
export const usePatchWritingDocumentFinish = (id: number) => {
const navigate = useNavigate();
return useMutation({
mutationFn: patchWritingDocumentFinish,
onSuccess: () => {
navigate(`/application/${id}`);
},
onError: (error) => {
console.error('서류 작성 완료하기 실패', error);
},
});
};

// 6.13 (유학생) 유학생 담당자 검토 완료 훅
export const usePatchContactCoordinator = () => {
return useMutation({
Expand Down
32 changes: 25 additions & 7 deletions src/pages/ApplicationDocuments/ApplicationDocumentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BottomButtonPanel from '@/components/Common/BottomButtonPanel';
import Button from '@/components/Common/Button';
import BaseHeader from '@/components/Common/Header/BaseHeader';
import DocumentCardList from '@/components/Document/DocumentCardList';
import { usePatchWritingDocumentFinish } from '@/hooks/api/useApplication';
import { useGetDocumentsEmployee } from '@/hooks/api/useDocument';
import { useCurrentPostIdEmployeeStore } from '@/store/url';
import { DocumentsSummaryResponse } from '@/types/api/document';
Expand All @@ -11,6 +12,9 @@ const ApplicationDocumentsPage = () => {
const navigate = useNavigate();
const { currentPostId } = useCurrentPostIdEmployeeStore();
const { data, isPending } = useGetDocumentsEmployee(Number(currentPostId));
const { mutate: submitDocuments } = usePatchWritingDocumentFinish(
Number(currentPostId),
);
return (
<div>
<BaseHeader
Expand All @@ -25,13 +29,27 @@ const ApplicationDocumentsPage = () => {
documents={data?.data as DocumentsSummaryResponse}
/>
<BottomButtonPanel>
<Button
type="large"
bgColor="bg-[#F4F4F9]"
fontColor="text-[#bdbdbd]"
isBorder={false}
title="Next"
/>
{data?.data.part_time_employment_permits?.status ===
'CONFIRMATION' &&
data?.data.standard_labor_contract?.status === 'CONFIRMATION' &&
data?.data.integrated_application?.hwp_url ? (
<Button
type="large"
bgColor={'bg-[#FEF387]'}
fontColor="text-[#1E1926]"
title="Next"
isBorder={false}
onClick={() => submitDocuments(Number(currentPostId))}
/>
) : (
<Button
type="large"
bgColor="bg-[#F4F4F9]"
fontColor="text-[#bdbdbd]"
isBorder={false}
title="Next"
/>
)}
</BottomButtonPanel>
</>
)}
Expand Down

0 comments on commit 5b8f05b

Please sign in to comment.