Skip to content

Commit

Permalink
fix: registerState 내부 업데이트 로직 변경, polygonProfile은 완전히 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
hjiwon committed Oct 14, 2023
1 parent 33d5d5c commit 904c3e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/pages/register/MRegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/pages/register/RegisterHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
20 changes: 10 additions & 10 deletions src/pages/register/StatusSelectGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,49 @@ const StatusSelectGroup = () => {
setIntelligenceOption(option);
setProfileStatus((prev) => ({
...prev,
polygonProfile: {
petPolygonProfileDto: {
...prev.petPolygonProfileDto,
intelligence: Number(option),
intelligence: option,
},
}));
break;
case 'affinity':
setAffinityOption(option);
setProfileStatus((prev) => ({
...prev,
polygonProfile: {
petPolygonProfileDto: {
...prev.petPolygonProfileDto,
affinity: Number(option),
affinity: option,
},
}));
break;
case 'athletic':
setAthleticOption(option);
setProfileStatus((prev) => ({
...prev,
polygonProfile: {
petPolygonProfileDto: {
...prev.petPolygonProfileDto,
athletic: Number(option),
athletic: option,
},
}));
break;
case 'adaptability':
setAdaptabilityOption(option);
setProfileStatus((prev) => ({
...prev,
polygonProfile: {
petPolygonProfileDto: {
...prev.petPolygonProfileDto,
adaptability: Number(option),
adaptability: option,
},
}));
break;
case 'activeness':
setActivenessOption(option);
setProfileStatus((prev) => ({
...prev,
polygonProfile: {
petPolygonProfileDto: {
...prev.petPolygonProfileDto,
activeness: Number(option),
activeness: option,
},
}));
break;
Expand Down

0 comments on commit 904c3e3

Please sign in to comment.