|
@@ -16,7 +16,7 @@ export const serverFetch: typeof fetch = async (input, init) => { |
|
|
...(accessToken |
|
|
...(accessToken |
|
|
? { |
|
|
? { |
|
|
Authorization: `Bearer ${accessToken}`, |
|
|
Authorization: `Bearer ${accessToken}`, |
|
|
Accept: "application/json" |
|
|
|
|
|
|
|
|
Accept: "application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" |
|
|
} |
|
|
} |
|
|
: {}), |
|
|
: {}), |
|
|
}, |
|
|
}, |
|
@@ -61,12 +61,14 @@ export async function serverFetchBlob<T>(...args: FetchParams) { |
|
|
const response = await serverFetch(...args); |
|
|
const response = await serverFetch(...args); |
|
|
|
|
|
|
|
|
if (response.ok) { |
|
|
if (response.ok) { |
|
|
console.log(response) |
|
|
|
|
|
// const blob = await response.blob() |
|
|
// const blob = await response.blob() |
|
|
// const blobText = await blob.text(); |
|
|
// const blobText = await blob.text(); |
|
|
// const blobType = await blob.type; |
|
|
// const blobType = await blob.type; |
|
|
const blobValue = (await response.body?.getReader().read())!!.value!! |
|
|
|
|
|
return {filename: response.headers.get("filename"), blobValue: blobValue} as T; |
|
|
|
|
|
|
|
|
const readBody = await response.body?.getReader().read() |
|
|
|
|
|
const bodyValue = readBody!!.value!! |
|
|
|
|
|
|
|
|
|
|
|
console.log(bodyValue) |
|
|
|
|
|
return {filename: response.headers.get("filename"), blobValue: bodyValue} as T; |
|
|
} else { |
|
|
} else { |
|
|
switch (response.status) { |
|
|
switch (response.status) { |
|
|
case 401: |
|
|
case 401: |
|
|