Handle upload failures

This commit is contained in:
2023-10-19 16:49:44 -04:00
parent a02cecb23b
commit 5f9dfb76e7

View File

@ -152,6 +152,24 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
},
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 (