Skip to content

Commit

Permalink
๐Ÿ› fix : ์ฃผ์„ ์‚ญ์ œ
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjuyoung99 committed Dec 10, 2024
1 parent 7a4ddd8 commit 41bed42
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/modals/OwnerUpdateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { FAMILY_ROLE } from '~constants/familyRole'
import { REVERSE_FAMILY_ROLE } from '~constants/familyRole'

import { FamilyRole, Gender } from '~types/common'
// import { validateOwnerProfile } from '~utils/validateOwnerProfile'

interface updateProfileType {
familyRole: FamilyRole
Expand All @@ -28,13 +29,13 @@ interface updateProfileType {
export default function OwnerUpdateModal() {
const pushModal = useModalStore(state => state.pushModal)
const popModal = useModalStore(state => state.popModal)

const [ownerProfile, setOwnerProfile] = useState<updateProfileType>({
familyRole: 'MOTHER',
gender: 'MALE', // ๊ธฐ๋ณธ๊ฐ’
name: '',
profileImg: '',
})

const [ProfileImage, setProfileImage] = useState<React.ComponentType | null>(null)

const queryClient = useQueryClient()
Expand All @@ -51,7 +52,6 @@ export default function OwnerUpdateModal() {
...data.data, // ์„œ๋ฒ„ ๋ฐ์ดํ„ฐ ๋ณ‘ํ•ฉ
familyRole: data.data.familyRole || prev.familyRole, // familyRole์ด ์—†์œผ๋ฉด ๊ธฐ์กด ๊ฐ’ ์œ ์ง€
}))
console.log('ownerProfile:', ownerProfile)
}
}, [data])

Expand All @@ -62,10 +62,6 @@ export default function OwnerUpdateModal() {
queryClient.invalidateQueries({ queryKey: queryKey.family.UpdateOwner() })
popModal()
},
onError: error => {
console.error('์ •๋ณด ์ˆ˜์ • ์‹คํŒจ:', error)
alert('์ •๋ณด ์ˆ˜์ •์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.')
},
})

useEffect(() => {
Expand Down Expand Up @@ -130,7 +126,6 @@ export default function OwnerUpdateModal() {
familyRole: REVERSE_FAMILY_ROLE[ownerProfile.familyRole] || ownerProfile.familyRole, // ENUM ๋ณ€ํ™˜ ๋˜๋Š” ๊ธฐ์กด ๊ฐ’ ์œ ์ง€
}

console.log('ํ”„๋กœํ•„ ์—…๋ฐ์ดํŠธ ์š”์ฒญ ๋ฐ์ดํ„ฐ:', updatedProfile)
updateOwnerMutation.mutate(updatedProfile) // ์„œ๋ฒ„๋กœ ์ „์†ก
}

Expand Down Expand Up @@ -186,12 +181,11 @@ export default function OwnerUpdateModal() {
</S.OwnerProfileSection>

<S.ToastWrapper>
<ActionButton $fontWeight='700' $bgColor='gc_1' onClick={handleUpdateClick}>
<ActionButton $fontWeight='700' $bgColor={'default'} onClick={handleUpdateClick}>
์ˆ˜์ • ์™„๋ฃŒ
</ActionButton>
<Toast />
</S.ToastWrapper>
</S.RegisterPage>
)
}

0 comments on commit 41bed42

Please sign in to comment.