diff --git a/src/Components/Facility/CoverImageEditModal.tsx b/src/Components/Facility/CoverImageEditModal.tsx index 56821dfc7cc..d521d55c7ce 100644 --- a/src/Components/Facility/CoverImageEditModal.tsx +++ b/src/Components/Facility/CoverImageEditModal.tsx @@ -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!", @@ -145,12 +150,6 @@ const CoverImageEditModal = ({ setIsProcessing(false); }, ); - - await sleep(1000); - setIsProcessing(false); - setIsCaptureImgBeingUploaded(false); - onSave && onSave(); - closeModal(); }; const handleDelete = async () => { diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 82ee82afb22..50edef824c8 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -58,6 +58,7 @@ export const FacilityHome = ({ facilityId }: Props) => { const { t } = useTranslation(); const [openDeleteDialog, setOpenDeleteDialog] = useState(false); const [editCoverImage, setEditCoverImage] = useState(false); + const [coverImageEdited, setCoverImageEdited] = useState(false); const authUser = useAuthUser(); useMessageListener((data) => console.log(data)); @@ -125,11 +126,20 @@ export const FacilityHome = ({ facilityId }: Props) => { ); const CoverImage = () => ( - + <> + + {coverImageEdited && ( +