Skip to content

Commit 5a996cd

Browse files
committed
Update Settings.tsx
1 parent b3142c9 commit 5a996cd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

apps/web/app/(org)/dashboard/settings/account/Settings.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,16 @@ export const Settings = ({
116116
});
117117

118118
const removeProfileImageMutation = useMutation({
119-
mutationFn: () => removeImage(user?.image || "", "user", user?.id || ""),
120-
onSuccess: (result) => {
121-
if (result?.success) {
122-
setProfileImageOverride(null);
123-
toast.success("Profile image removed");
124-
router.refresh();
119+
mutationFn: () => {
120+
if (!user?.id) {
121+
throw new Error("User ID is required");
125122
}
123+
return removeImage(user.image || "", "user", user.id);
124+
},
125+
onSuccess: () => {
126+
setProfileImageOverride(null);
127+
toast.success("Profile image removed");
128+
router.refresh();
126129
},
127130
onError: (error) => {
128131
console.error("Error removing profile image:", error);

0 commit comments

Comments
 (0)