From a13f185f0275e85310b7c5f6364e0c4a5cb400b3 Mon Sep 17 00:00:00 2001 From: hongggy Date: Tue, 10 Dec 2024 10:06:58 +0900 Subject: [PATCH 1/6] =?UTF-8?q?chore:=20response=20=EC=B6=9C=EB=A0=A5=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/forms/[formId]/applications/route.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/api/forms/[formId]/applications/route.ts b/src/app/api/forms/[formId]/applications/route.ts index 53c274aa..733d5fd5 100644 --- a/src/app/api/forms/[formId]/applications/route.ts +++ b/src/app/api/forms/[formId]/applications/route.ts @@ -20,9 +20,10 @@ export async function POST(req: NextRequest, { params }: { params: { formId: str "Content-Type": "application/json", }, }); - + console.log(response.data); return NextResponse.json(response.data); } catch (error: unknown) { + console.error(error); if (error instanceof AxiosError) { console.error(`POST /api/forms/${params.formId}/applications error:`, error); if (error.response) { From 1bd891f0531413a3b41c4257ca8072a5a7622377 Mon Sep 17 00:00:00 2001 From: hongggy Date: Tue, 10 Dec 2024 10:56:56 +0900 Subject: [PATCH 2/6] =?UTF-8?q?chore:=20=ED=83=AD=20=EC=9E=91=EC=84=B1?= =?UTF-8?q?=EC=A4=91=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(albaform)/addform/RecruitContent.tsx | 5 ++- src/app/(pages)/(albaform)/addform/page.tsx | 33 ++++++++----------- .../layout/addFormLayout/ApplyHeader.tsx | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/app/(pages)/(albaform)/addform/RecruitContent.tsx b/src/app/(pages)/(albaform)/addform/RecruitContent.tsx index 9f02d4e0..d18b1a3c 100644 --- a/src/app/(pages)/(albaform)/addform/RecruitContent.tsx +++ b/src/app/(pages)/(albaform)/addform/RecruitContent.tsx @@ -24,13 +24,12 @@ export default function RecruitContent() { } = useFormContext(); const currentValue = getValues(); - + const prevImageFiles = currentValue.imageFiles; // 이미지 파일 change핸들러 const handleChangeImages = (files: File[]) => { // 훅폼 데이터에 추가-> 상위 페이지에서 "imageFiles" data를 관리할 수 있음 - setValue("imageFiles", files); + setValue("imageFiles", [...prevImageFiles, files]); - // 기존 이미지 리스트와 새로운 이미지를 합침 setInitialImageList((prevList) => [ ...prevList, ...files.map((file: File) => ({ diff --git a/src/app/(pages)/(albaform)/addform/page.tsx b/src/app/(pages)/(albaform)/addform/page.tsx index 24254bac..109ac3a1 100644 --- a/src/app/(pages)/(albaform)/addform/page.tsx +++ b/src/app/(pages)/(albaform)/addform/page.tsx @@ -66,13 +66,12 @@ export default function AddFormPage() { const { setValue, - getValues, handleSubmit, formState: { isDirty, isValid }, } = methods; // 훅폼에서 관리하는 전체 데이터를 가져오는 함수 - const currentValues: SubmitFormDataType = getValues(); + const currentValues: SubmitFormDataType = methods.watch(); // 이미지 업로드 api 처리를 위해 별도 변수에 할당 const imageFiles = currentValues.imageFiles; @@ -204,33 +203,27 @@ export default function AddFormPage() { window.localStorage.setItem("tempAddFormData", JSON.stringify(currentValues)); } toast.success("임시 저장되었습니다."); - // console.log("임시저장 데이터", currentValues); + console.log("임시저장 데이터", currentValues); }; // 각각의 탭 작성중 여부 const isEditingRecruitContent = - currentValues.title !== "" || - currentValues.description !== "" || - currentValues.recruitmentStartDate !== "" || - currentValues.imageUrls + currentValues.title !== "" || currentValues.description !== "" || currentValues.recruitmentStartDate !== undefined ? true : false; const isEditingRecruitCondition = - currentValues.gender || - currentValues.numberOfPositions || - currentValues.education || - currentValues.age || - currentValues.preferred + currentValues.gender !== "" || + currentValues.numberOfPositions !== 0 || + currentValues.education !== "" || + currentValues.age !== "" || + currentValues.preferred !== "" ? true : false; const isEditingWorkCondition = - currentValues.location || - currentValues.workDays || - currentValues.workStartTime || - currentValues.workStartDate || - currentValues.hourlyWage || - currentValues.isNegotiableWorkDays || - currentValues.isPublic + currentValues.location !== "" || + currentValues.workStartTime !== "" || + currentValues.workStartDate !== "" || + currentValues.hourlyWage > 0 ? true : false; @@ -242,7 +235,7 @@ export default function AddFormPage() { options={[ { label: "모집 내용", - isEditing: isEditingRecruitContent || initialLoad || currentParam === "recruit-condition", + isEditing: isEditingRecruitContent || initialLoad || currentParam === "recruit-content", }, { label: "모집 조건", isEditing: isEditingRecruitCondition || currentParam === "recruit-condition" }, { label: "근무 조건", isEditing: isEditingWorkCondition || currentParam === "work-condition" }, diff --git a/src/app/components/layout/addFormLayout/ApplyHeader.tsx b/src/app/components/layout/addFormLayout/ApplyHeader.tsx index 11ecc82e..460a9107 100644 --- a/src/app/components/layout/addFormLayout/ApplyHeader.tsx +++ b/src/app/components/layout/addFormLayout/ApplyHeader.tsx @@ -2,7 +2,7 @@ import Button from "@/app/components/button/default/Button"; const ApplyHeader = ({ title, onCancel }: { title: string; onCancel: () => void }) => { return ( -
+

{title}