Skip to content

Commit

Permalink
Add content type to frontend fetchs
Browse files Browse the repository at this point in the history
  • Loading branch information
CrissAlvarezH committed Dec 10, 2024
1 parent d2bf175 commit 37e08ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/frontend/src/services/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 13,7 @@ export const DEFAULT_PART_SIZE = 5;
export async function uploadFileByParts(file, { batchSize, partSize = DEFAULT_PART_SIZE, onProgress } = {}) {
const initRes = await fetch(`${API_DOMAIN}/upload/init`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
filename: file.name,
}),
Expand All @@ -33,9 34,10 @@ export async function uploadFileByParts(file, { batchSize, partSize = DEFAULT_PA

const presignedRes = await fetch(`${API_DOMAIN}/upload/get-presigned-url`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
filename: file.name,
upload_id:uploadId,
upload_id: uploadId,
part_number: partNumber,
}),
});
Expand Down Expand Up @@ -71,9 73,10 @@ export async function uploadFileByParts(file, { batchSize, partSize = DEFAULT_PA

const completeRes = await fetch(`${API_DOMAIN}/upload/complete`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
filename: file.name,
upload_id:uploadId,
upload_id: uploadId,
// parts must be sorted by part number
parts: partResults.sort((a, b) => a.PartNumber - b.PartNumber),
}),
Expand Down

0 comments on commit 37e08ee

Please sign in to comment.