Handle upload failures

This commit is contained in:
regalijan 2023-10-19 16:49:44 -04:00
parent a02cecb23b
commit 5f9dfb76e7
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -152,6 +152,24 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
}, },
method: "PUT", method: "PUT",
}); });
if (!fileUpload.ok) {
await fetch("/api/reports/recall", {
body: JSON.stringify({ id }),
headers: {
"content-type": "application/json",
},
method: "POST",
});
useToast()({
description: "Failed to upload file",
status: "error",
title: "Error",
});
return;
}
} }
return ( return (