Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle upload failures
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent a02cecb commit 5f9dfb7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions components/NewGameBan.tsx
Expand Up @@ -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 (
Expand Down

0 comments on commit 5f9dfb7

Please sign in to comment.