mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Added try block around s3 upload
This commit is contained in:
parent
e82e340325
commit
6d4988c46b
1 changed files with 9 additions and 8 deletions
|
|
@ -38,17 +38,18 @@ async function uploadCsvToS3({
|
|||
presignedUrl: string;
|
||||
file: File;
|
||||
}) {
|
||||
const upload = await fetch(presignedUrl, {
|
||||
method: "PUT",
|
||||
body: file,
|
||||
headers: { "Content-Type": "text/csv" },
|
||||
});
|
||||
|
||||
if (!upload.ok) {
|
||||
try {
|
||||
await fetch(presignedUrl, {
|
||||
method: "PUT",
|
||||
body: file,
|
||||
headers: { "Content-Type": "text/csv" },
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw new Error("Upload failed.");
|
||||
}
|
||||
|
||||
return upload;
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
export const SubmitPlan = ({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue