generated from corrad-software/corrad-af-2024
Removed sending file to the backend
Direct-to-storage upload instead of sending to the backend since sending files to the backend from the frontend is forbidden for some reason.
This commit is contained in:
parent
0ba58a1efb
commit
cb7f104b1d
@ -334,13 +334,12 @@ const performUpload = async () => {
|
|||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('fileName', metadata.name);
|
formData.append('fileName', metadata.name);
|
||||||
formData.append('file', file);
|
// formData.append('file', file);
|
||||||
|
|
||||||
console.log(formData);
|
console.log(formData);
|
||||||
|
|
||||||
const response = await fetch('/api/dms/upload-file', {
|
const response = await fetch('/api/dms/upload-file', {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
// Let browser automatically set headers for multipart/form-data
|
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
@ -42,7 +42,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create S3 client with config
|
// Create S3 client with config
|
||||||
const client = new S3Client(S3_Config);
|
const s3Client = new S3Client(S3_Config);
|
||||||
|
|
||||||
// const { fileName, file } = await readMultipartFormData(event);
|
// const { fileName, file } = await readMultipartFormData(event);
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
const command = new PutObjectCommand(input);
|
const command = new PutObjectCommand(input);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await client.send(command);
|
const response = await s3Client.send(command);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user