Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Notifications for Facility Cover Image Deletion #7609

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Components/Facility/CoverImageEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CoverImageEditModal = ({
facility,
}: Props) => {
const [isUploading, setIsUploading] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
const [selectedFile, setSelectedFile] = useState<any>();
const [preview, setPreview] = useState<string>();
const [isCameraOpen, setIsCameraOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -143,14 +144,16 @@ const CoverImageEditModal = ({
};

const handleDelete = async () => {
setIsDeleting(true);
const { res } = await request(routes.deleteFacilityCoverImage, {
pathParams: { id: facility.id! },
});
if (res?.ok) {
Success({ msg: "Cover image deleted" });
onDelete?.();
closeModal();
}
setIsDeleting(false);
onDelete?.();
closeModal();
};

const hasImage = !!(preview || facility.read_cover_image_url);
Expand Down Expand Up @@ -283,7 +286,7 @@ const CoverImageEditModal = ({
<ButtonV2
variant="danger"
onClick={handleDelete}
disabled={isUploading}
disabled={isDeleting}
>
{t("delete")}
</ButtonV2>
Expand Down
Loading