From f2280ea8cc192c8faf754bc1dee2cb172be72511 Mon Sep 17 00:00:00 2001 From: YIMSEBIN Date: Tue, 12 Nov 2024 00:18:15 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=ED=9A=8C=EC=82=AC=EB=93=B1=EB=A1=9D?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20(=ED=95=84=EC=88=98->=EC=84=A0?= =?UTF-8?q?=ED=83=9D)=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/registerCompany/mocks/registerCompany.mock.ts | 2 +- src/pages/registerCompany/RegisterCompany.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apis/registerCompany/mocks/registerCompany.mock.ts b/src/apis/registerCompany/mocks/registerCompany.mock.ts index ae6e0ba..65d9bbd 100644 --- a/src/apis/registerCompany/mocks/registerCompany.mock.ts +++ b/src/apis/registerCompany/mocks/registerCompany.mock.ts @@ -3,7 +3,7 @@ import { getPostCompanyPath } from '../hooks/useRegisterCompany'; export const registerCompanyMockHandler = [ http.post(getPostCompanyPath(), async ({ request }) => { - const req = await request.json(); + const req = await request.formData(); return HttpResponse.json(req, { status: 201 }); }), ]; diff --git a/src/pages/registerCompany/RegisterCompany.tsx b/src/pages/registerCompany/RegisterCompany.tsx index 59e5089..99fb3b1 100644 --- a/src/pages/registerCompany/RegisterCompany.tsx +++ b/src/pages/registerCompany/RegisterCompany.tsx @@ -72,7 +72,6 @@ export default function RegisterCompany() { if (!industryOccupation) newErrors.industryOccupation = '산업/직종을 입력해주세요.'; if (!brand) newErrors.brand = '브랜드명을 입력해주세요.'; if (!revenuePerYear) newErrors.revenuePerYear = '연 매출을 입력해주세요.'; - if (!file) newErrors.logoImage = '로고 이미지를 업로드해주세요.'; setErrors(newErrors); @@ -91,7 +90,10 @@ export default function RegisterCompany() { if (file) { formData.append('logoImage', file); + } else { + formData.append('logoImage', ''); } + mutation.mutate(formData, { onSuccess: () => { navigate(ROUTE_PATH.HOME); From dcc6e8751fe0a19984fa2f72b45269c55de5fc82 Mon Sep 17 00:00:00 2001 From: YIMSEBIN Date: Tue, 12 Nov 2024 21:21:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EA=B7=BC=EB=A1=9C=EC=9E=90=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20status=20=EC=B5=9C=EC=A2=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../employee/mock/myApplicationList.mock.ts | 8 +++--- .../employee/myPage/MyRecruitCard.tsx | 25 ++++++++++--------- src/types/index.d.ts | 13 ++-------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/apis/employee/mock/myApplicationList.mock.ts b/src/apis/employee/mock/myApplicationList.mock.ts index bfa25d9..d5b674b 100644 --- a/src/apis/employee/mock/myApplicationList.mock.ts +++ b/src/apis/employee/mock/myApplicationList.mock.ts @@ -7,7 +7,7 @@ export const myApplicationList: MyRecruitListProps[] = [ 'https://img.freepik.com/free-photo/low-angle-view-of-skyscrapers_1359-1105.jpg?size=626&ext=jpg&ga=GA1.1.1297763733.1727740800&semt=ais_hybrid', title: '제목', area: '대전광역시 유성구', - state: 'SIGNING_EMPLOYMENT_CONTRACT', + status: '근로계약서 서명하기', applyId: 1, }, { @@ -16,7 +16,7 @@ export const myApplicationList: MyRecruitListProps[] = [ 'https://img.freepik.com/free-photo/low-angle-view-of-skyscrapers_1359-1105.jpg?size=626&ext=jpg&ga=GA1.1.1297763733.1727740800&semt=ais_hybrid', title: '제목2', area: '대전광역시 유성구', - state: 'HIRING_CLOSED', + status: '채용마감', applyId: 2, }, { @@ -25,7 +25,7 @@ export const myApplicationList: MyRecruitListProps[] = [ 'https://img.freepik.com/free-photo/low-angle-view-of-skyscrapers_1359-1105.jpg?size=626&ext=jpg&ga=GA1.1.1297763733.1727740800&semt=ais_hybrid', title: '제목3', area: '대전광역시 유성구', - state: 'REVIEWING_APPLICATION', + status: '지원서 검토중', applyId: 3, }, { @@ -34,7 +34,7 @@ export const myApplicationList: MyRecruitListProps[] = [ 'https://img.freepik.com/free-photo/low-angle-view-of-skyscrapers_1359-1105.jpg?size=626&ext=jpg&ga=GA1.1.1297763733.1727740800&semt=ais_hybrid', title: '제목4', area: '대전광역시 유성구', - state: 'HIRED', + status: '채용완료', applyId: 4, }, ]; diff --git a/src/features/employee/myPage/MyRecruitCard.tsx b/src/features/employee/myPage/MyRecruitCard.tsx index fe215cd..e363547 100644 --- a/src/features/employee/myPage/MyRecruitCard.tsx +++ b/src/features/employee/myPage/MyRecruitCard.tsx @@ -1,6 +1,6 @@ import { Card, Image, Typo, Button } from '@/components/common'; import styled from '@emotion/styled'; -import { MyRecruitListProps, StateProps, TextProps } from '@/types'; +import { MyRecruitListProps, StateProps } from '@/types'; import { useNavigate } from 'react-router-dom'; import ROUTE_PATH from '@/routes/path'; import { useGetContractImg } from '@/apis/contract/hooks/useGetContractImg'; @@ -8,23 +8,23 @@ import React from 'react'; type DesignProps = { design: 'default' | 'outlined' | 'textbutton' | 'deactivate'; - text?: TextProps; + text?: string; style?: React.CSSProperties; }; -function getStateStyle(state: StateProps): DesignProps { - switch (state) { - case 'SIGNING_EMPLOYMENT_CONTRACT': +function getStateStyle(status: StateProps): DesignProps { + switch (status) { + case '근로계약서 서명하기': return { design: 'default', text: '근로계약서 서명하기' }; - case 'HIRING_CLOSED': + case '채용마감': return { design: 'deactivate', text: '채용 마감' }; - case 'REVIEWING_APPLICATION': + case '지원서 검토중': return { design: 'deactivate', text: '지원서 검토중', style: { backgroundColor: '#fff', border: '3px solid #9A9A9A' }, }; - case 'HIRED': + case '채용완료': return { design: 'outlined', text: '근로계약서 다운로드' }; default: return { design: 'deactivate' }; // 상태가 정의되지 않은 경우 @@ -41,9 +41,10 @@ type DownloadContractProps = { }; export default function MyRecruitCard({ myRecruit }: Props) { - const { image, title, area, state, applyId } = myRecruit; - const buttonStyle = getStateStyle(state); + const { image, title, area, status, applyId } = myRecruit; + const buttonStyle = getStateStyle(status); const navigate = useNavigate(); + // 근로계약서 이미지 다운로드 const downloadContract = () => { const { data: imgURLs } = useGetContractImg(applyId); @@ -87,9 +88,9 @@ export default function MyRecruitCard({ myRecruit }: Props) { design={buttonStyle.design} style={{ width: '200px', padding: '10px 20px', ...buttonStyle.style }} onClick={() => { - if (state == 'SIGNING_EMPLOYMENT_CONTRACT') { + if (status == '근로계약서 서명하기') { navigate(ROUTE_PATH.CONTRACT.EMPLOYEE.replace(':applyId', applyId.toString())); - } else if (state == 'HIRED') { + } else if (status == '채용완료') { downloadContract(); } }} diff --git a/src/types/index.d.ts b/src/types/index.d.ts index c48cc9e..a60f7fa 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -28,23 +28,14 @@ export type UserData = { name: string; }; -// 백엔드에서 정하는 값에 따라 key 바꾸면 됨 -export const State = { - SIGNING_EMPLOYMENT_CONTRACT: '근로계약서 서명하기', - HIRING_CLOSED: '채용 마감', - REVIEWING_APPLICATION: '지원서 검토중', - HIRED: '근로계약서 다운로드', -} as const; - -export type StateProps = keyof typeof State; -export type TextProps = (typeof State)[StateProps]; +export type StateProps = '근로계약서 서명하기' | '채용마감' | '지원서 검토중' | '채용완료'; export type MyRecruitListProps = { id: number; title: string; area: string; image: string; - state: StateProps; + status: StateProps; applyId: number; };