diff --git a/src/app/api/reports/actions.ts b/src/app/api/reports/actions.ts index 6a7e70c..be74c6f 100644 --- a/src/app/api/reports/actions.ts +++ b/src/app/api/reports/actions.ts @@ -19,7 +19,5 @@ export const fetchEX02ProjectCashFlowReport = async (data: EX02ProjectCashFlowRe }, ); - console.log(reportBlob) - return reportBlob }; \ No newline at end of file diff --git a/src/app/utils/fetchUtil.ts b/src/app/utils/fetchUtil.ts index 7e9ab5f..8f563e2 100644 --- a/src/app/utils/fetchUtil.ts +++ b/src/app/utils/fetchUtil.ts @@ -16,7 +16,7 @@ export const serverFetch: typeof fetch = async (input, init) => { ...(accessToken ? { Authorization: `Bearer ${accessToken}`, - Accept: "application/json" + Accept: "application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" } : {}), }, @@ -61,12 +61,14 @@ export async function serverFetchBlob(...args: FetchParams) { const response = await serverFetch(...args); if (response.ok) { - console.log(response) // const blob = await response.blob() // const blobText = await blob.text(); // 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 { switch (response.status) { case 401: