Skip to content

Commit ce7c1a6

Browse files
committed
fix: 프로필 수정 시 이미지 삭제 가능하도록 수정
1 parent 257382f commit ce7c1a6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/features/editProfile/ui/ProfileEditModal/ProfileEditModal.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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", {

0 commit comments

Comments
 (0)