refactor: Upload file to storage, and then pass attachmentId to collections.import
This avoids having large file uploads going directly to the server and allows us to fetch it async into a worker process
This commit is contained in:
@ -39,11 +39,13 @@ export const uploadFile = async (
|
||||
formData.append("file", file);
|
||||
}
|
||||
|
||||
await fetch(data.uploadUrl, {
|
||||
const uploadResponse = await fetch(data.uploadUrl, {
|
||||
method: "post",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
invariant(uploadResponse.ok, "Upload failed, try again?");
|
||||
|
||||
return attachment;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user