Skip to content

Commit

Permalink
✨ feat: 서류 재검토 요청 페이지, 로직 구현 #54
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMirror21 committed Oct 26, 2024
1 parent 71622bd commit f49091c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/api/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,17 @@ export const searchSchool = async (
);
return response.data;
};

// 8.9 (유학생) 서류 (근로계약서, 시간제 취업허가서) 재검토 요청하기
export const postRequest = async ({
id,
reason,
}: {
id: number;
reason: string;
}): Promise<{ id: number }> => {
const response = await api.post(`/users/documents/${id}/status/requestion`, {
reason: reason,
});
return response.data;
};
13 changes: 13 additions & 0 deletions src/hooks/api/useDocument.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
postIntegratedApplications,
postPartTimeEmployPermit,
postRequest,
postStandardLaborContracts,
putIntegratedApplications,
putPartTimeEmployPermit,
Expand Down Expand Up @@ -131,3 +132,15 @@ export const useSearchSchool = ({
});
return { searchSchool: mutate, ...rest };
};

// 8.14 (유학생) 통합신청서 수정 api 통신 커스텀 훅
export const usePostRequest = () => {
const navigate = useNavigate();
return useMutation({
mutationFn: postRequest,
onSuccess: () => {
navigate('/application-documents');
},
onError: () => navigate('/request-modify'),
});
};
54 changes: 54 additions & 0 deletions src/pages/WriteDocuments/RequestModifyPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import BottomButtonPanel from '@/components/Common/BottomButtonPanel';
import Button from '@/components/Common/Button';
import BaseHeader from '@/components/Common/Header/BaseHeader';
import { usePostRequest } from '@/hooks/api/useDocument';
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';

const RequestModifyPage = () => {
const navigate = useNavigate();
const [reasonInput, setReasonInput] = useState('');
const { mutate: sendRequest } = usePostRequest();
return (
<div>
<BaseHeader
hasBackButton={true}
hasMenuButton={true}
title="Reason for Request"
onClickBackButton={() => navigate('/application-documents')}
/>
<div className="w-full relative flex flex-col items-center justify-start text-left text-[#1e1926] head-1">
<div className="self-stretch flex items-center justify-start p-6">
Reason for Request
</div>
<div className="w-full self-stretch flex flex-col items-center justify-start pb-[10rem] px-6 body-3">
<div className="w-full flex flex-col items-start justify-start">
<div className="w-full flex flex-col items-center justify-start">
<textarea
className="w-full h-[7.5rem] px-[1rem] py-[0.75rem] border border-[#E2E5EB] rounded-[0.75rem] body-2 outline-none resize-none"
placeholder="Write a contract review"
value={reasonInput}
maxLength={100}
onChange={(e) => setReasonInput(e.target.value)}
/>
</div>
</div>
</div>
</div>
<BottomButtonPanel>
<Button
type="large"
isBorder={false}
bgColor="bg-[#FEF387]"
fontColor="text-[#1E1926]"
title="Request"
onClick={() => {
sendRequest({ id: 1, reason: reasonInput });
}}
/>
</BottomButtonPanel>
</div>
);
};

export default RequestModifyPage;
2 changes: 2 additions & 0 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import WriteDocumentsPage from '@/pages/WriteDocuments/WriteDocumentsPage';
import ApplicationDetailPage from '@/pages/ApplicationDetail/ApplicationDetailPage';
import ApplicationResultPage from '@/pages/ApplicationResult/ApplicationResultPage';
import EmployerPostDetailPage from '@/pages/Employer/PostDetail/EmployerPostDetailPage';
import RequestModifyPage from './pages/WriteDocuments/RequestModifyPage';

const Layout = () => {
const location = useLocation();
Expand Down Expand Up @@ -68,6 +69,7 @@ const Router = () => {
element={<EmployerPostDetailPage />}
/>
<Route path="/write-documents" element={<WriteDocumentsPage />} />
<Route path="/request-modify" element={<RequestModifyPage />} />

<Route path="/application" element={<ApplicationPage />} />
</Route>
Expand Down

0 comments on commit f49091c

Please sign in to comment.