mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
upload file working, need to implement api call to backend service
This commit is contained in:
parent
c8e200eda7
commit
9be55a54bf
1 changed files with 3 additions and 2 deletions
|
|
@ -39,10 +39,10 @@ async function uploadCsvToS3({
|
|||
presignedUrl: string;
|
||||
file: File;
|
||||
}) {
|
||||
console.log("Uploading file to s3");
|
||||
const upload = await fetch(presignedUrl, {
|
||||
method: "PUT",
|
||||
body: file,
|
||||
headers: { "Content-Type": "text/csv" },
|
||||
});
|
||||
|
||||
if (!upload.ok) {
|
||||
|
|
@ -64,7 +64,7 @@ export const SubmitPlan = ({
|
|||
goal: string;
|
||||
housingType: string;
|
||||
goalValue: string;
|
||||
file: File | null;
|
||||
file: File;
|
||||
portfolioId: number;
|
||||
}) => {
|
||||
const router = useRouter();
|
||||
|
|
@ -87,6 +87,7 @@ export const SubmitPlan = ({
|
|||
|
||||
const { mutate, isLoading } = useMutation(generatePresignedUrl, {
|
||||
onSuccess: (data) => {
|
||||
console.log("Got url: ", data.url);
|
||||
// After the presigned URL has been generated, we can upload the file to S3
|
||||
mutateUploadCsv({ presignedUrl: data.url, file: file });
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue