Skip to content

Commit

Permalink
Fix the loading state when avatar upload fails (#8881)
Browse files Browse the repository at this point in the history
  • Loading branch information
nithish1018 authored Oct 27, 2024
1 parent 60f02ee commit 59056d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Common/AvatarEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ const AvatarEditModal = ({

setIsProcessing(true);
setIsCaptureImgBeingUploaded(true);

await handleUpload(selectedFile, () => {
setSelectedFile(undefined);
setPreview(undefined);
setPreviewImage(null);
setIsCaptureImgBeingUploaded(false);
setIsProcessing(false);
});
Expand Down
2 changes: 2 additions & 0 deletions src/components/Facility/FacilityHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export const FacilityHome = ({ facilityId }: Props) => {
facilityFetch();
Notification.Success({ msg: "Cover image updated." });
setEditCoverImage(false);
} else {
onError();
}
},
null,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Users/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ export default function UserProfile() {
refetchUser();
Notification.Success({ msg: "Profile picture updated." });
setEditAvatar(false);
} else {
onError();
}
},
null,
Expand Down

0 comments on commit 59056d0

Please sign in to comment.