Skip to content

Commit

Permalink
Fixes facility cover image from not reloading after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Aug 23, 2024
1 parent e567f59 commit 9ccf444
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Components/Facility/CoverImageEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,14 @@ const CoverImageEditModal = ({
Authorization:
"Bearer " + localStorage.getItem(LocalStorageKeys.accessToken),
},
(xhr: XMLHttpRequest) => {
async (xhr: XMLHttpRequest) => {
if (xhr.status === 200) {
Success({ msg: "Cover image updated." });
setIsProcessing(false);
setIsCaptureImgBeingUploaded(false);
await sleep(1000);
onSave?.();
closeModal();
} else {
Notification.Error({
msg: "Something went wrong!",
Expand All @@ -145,12 +150,6 @@ const CoverImageEditModal = ({
setIsProcessing(false);
},
);

await sleep(1000);
setIsProcessing(false);
setIsCaptureImgBeingUploaded(false);
onSave && onSave();
closeModal();
};

const handleDelete = async () => {
Expand Down

0 comments on commit 9ccf444

Please sign in to comment.