File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/features/editProfile/ui/ProfileEditModal Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -70,16 +70,19 @@ export const ProfileEditModal = ({
7070 if ( ! isChanged ) return ;
7171 setLoading ( true ) ;
7272
73- let uploadedImageUrl = imageUrl ;
73+ let uploadedImageUrl : string | null | undefined = imageUrl ;
7474
7575 if ( imageFile ) {
7676 uploadedImageUrl = await uploadImage ( imageFile ) ;
77+ } else if ( imageChanged ) {
78+ uploadedImageUrl = null ;
7779 }
7880
79- const updateBody : Record < string , string > = { } ;
81+ const updateBody : Record < string , string | null > = { } ;
8082 if ( nickname . trim ( ) ) updateBody . nickname = nickname ;
8183 if ( introduction . trim ( ) ) updateBody . introduction = introduction ;
82- if ( uploadedImageUrl ) updateBody . imageUrl = uploadedImageUrl ;
84+ if ( uploadedImageUrl !== undefined )
85+ updateBody . imageUrl = uploadedImageUrl ;
8386 if ( category . trim ( ) ) updateBody . category = category ;
8487
8588 await apiFetch ( "/api/users/me" , {
You can’t perform that action at this time.
0 commit comments