From 904c3e3443340728d4c47e10e5983d5665c1546e Mon Sep 17 00:00:00 2001 From: hjiwon Date: Sat, 14 Oct 2023 22:38:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20registerState=20=EB=82=B4=EB=B6=80=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD,=20polygonProfile=EC=9D=80=20=EC=99=84?= =?UTF-8?q?=EC=A0=84=ED=9E=88=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/register/MRegisterForm.tsx | 6 ++++-- src/pages/register/RegisterHeader.tsx | 1 + src/pages/register/StatusSelectGroup.tsx | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/pages/register/MRegisterForm.tsx b/src/pages/register/MRegisterForm.tsx index 1241bcf5..dbd1d200 100644 --- a/src/pages/register/MRegisterForm.tsx +++ b/src/pages/register/MRegisterForm.tsx @@ -59,9 +59,11 @@ const MRegisterForm = () => { const tempPetInfo = { ...petInfo, [fieldName]: newValue }; const allFieldsFilled = Object.values(tempPetInfo).every((value, index) => { // isComplete는 petInfo의 모든 필드가 채워져 있을 때 true - if (index === Object.values(petInfo).length - 1) { + if ( + Object.keys(tempPetInfo)[index] === 'isComplete' || + Object.keys(tempPetInfo)[index] === 'protectionExpirationDate' + ) return true; - } return !!value; }); if (allFieldsFilled) { diff --git a/src/pages/register/RegisterHeader.tsx b/src/pages/register/RegisterHeader.tsx index 16daec36..f3b1f46c 100644 --- a/src/pages/register/RegisterHeader.tsx +++ b/src/pages/register/RegisterHeader.tsx @@ -43,6 +43,7 @@ const RegisterHeader = () => { }; const { data, mutate, isError, isLoading, isSuccess } = useMutation(postPet); const handleRegisterButtonClick = async () => { + console.log(registerPetData); if (!selectedImageFile || !selectedVideoFile || !registerPetData.isComplete) return; const formData = new FormData(); diff --git a/src/pages/register/StatusSelectGroup.tsx b/src/pages/register/StatusSelectGroup.tsx index 36be27ce..ae962503 100644 --- a/src/pages/register/StatusSelectGroup.tsx +++ b/src/pages/register/StatusSelectGroup.tsx @@ -19,9 +19,9 @@ const StatusSelectGroup = () => { setIntelligenceOption(option); setProfileStatus((prev) => ({ ...prev, - polygonProfile: { + petPolygonProfileDto: { ...prev.petPolygonProfileDto, - intelligence: Number(option), + intelligence: option, }, })); break; @@ -29,9 +29,9 @@ const StatusSelectGroup = () => { setAffinityOption(option); setProfileStatus((prev) => ({ ...prev, - polygonProfile: { + petPolygonProfileDto: { ...prev.petPolygonProfileDto, - affinity: Number(option), + affinity: option, }, })); break; @@ -39,9 +39,9 @@ const StatusSelectGroup = () => { setAthleticOption(option); setProfileStatus((prev) => ({ ...prev, - polygonProfile: { + petPolygonProfileDto: { ...prev.petPolygonProfileDto, - athletic: Number(option), + athletic: option, }, })); break; @@ -49,9 +49,9 @@ const StatusSelectGroup = () => { setAdaptabilityOption(option); setProfileStatus((prev) => ({ ...prev, - polygonProfile: { + petPolygonProfileDto: { ...prev.petPolygonProfileDto, - adaptability: Number(option), + adaptability: option, }, })); break; @@ -59,9 +59,9 @@ const StatusSelectGroup = () => { setActivenessOption(option); setProfileStatus((prev) => ({ ...prev, - polygonProfile: { + petPolygonProfileDto: { ...prev.petPolygonProfileDto, - activeness: Number(option), + activeness: option, }, })); break;