fix: profile picture modal close on remove functionality added and mutation fix (#4757)

This commit is contained in:
Anmol Singh Bhatia 2024-06-11 17:33:45 +05:30 committed by GitHub
parent b05579d506
commit 778fca9db6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,7 @@ const ProfileSettingsPage = observer(() => {
reset,
watch,
control,
setValue,
formState: { errors },
} = useForm<IUser>({ defaultValues });
// store hooks
@ -104,6 +105,7 @@ const ProfileSettingsPage = observer(() => {
message: "Profile picture deleted successfully.",
});
setIsRemoving(false);
setValue("avatar", "");
})
.catch(() => {
setToast({
@ -112,7 +114,10 @@ const ProfileSettingsPage = observer(() => {
message: "There was some error in deleting your profile picture. Please try again.",
});
})
.finally(() => setIsRemoving(false));
.finally(() => {
setIsRemoving(false);
setIsImageUploadModalOpen(false);
});
});
};