From cc7891b178be77f9d9ff54428855729e52919185 Mon Sep 17 00:00:00 2001 From: Viet Anh Nguyen Date: Tue, 6 Feb 2024 10:09:02 +0700 Subject: [PATCH] Fix download filename --- .../report-detail/report-overview-table.tsx | 2 +- cope2n-fe/src/request/report.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cope2n-fe/src/components/report-detail/report-overview-table.tsx b/cope2n-fe/src/components/report-detail/report-overview-table.tsx index 3292d8e..5f0f1c1 100644 --- a/cope2n-fe/src/components/report-detail/report-overview-table.tsx +++ b/cope2n-fe/src/components/report-detail/report-overview-table.tsx @@ -133,7 +133,7 @@ const columns: TableColumnsType = [ key: 'snImeiAAR', width: '130px', render: (_, record) => { - const isAbnormal = record.snImeiAAR * 100 < 98; + const isAbnormal = record.snImeiAAR * 100 < 95; return ( {(record.snImeiAAR * 100)?.toFixed(2)} diff --git a/cope2n-fe/src/request/report.ts b/cope2n-fe/src/request/report.ts index b66277a..8a375d9 100644 --- a/cope2n-fe/src/request/report.ts +++ b/cope2n-fe/src/request/report.ts @@ -94,8 +94,10 @@ export async function downloadReport(report_id: string) { let filename = "report.xlsx"; try { let basename = response.headers['content-disposition'].split('filename=')[1].split('.')[0]; - let extension = response.headers['content-disposition'].split('.')[1].split(';')[0]; - filename = `${basename}.${extension}` + if (basename[0] == '_') { + basename = basename.substring(1); + } + filename = `${basename}.xlsx` } catch(err) { console.log(err); } @@ -123,8 +125,10 @@ export async function downloadDashboardReport(duration='30d', subsidiary='ALL') let filename = "report.xlsx"; try { let basename = response.headers['content-disposition'].split('filename=')[1].split('.')[0]; - let extension = response.headers['content-disposition'].split('.')[1].split(';')[0]; - filename = `${basename}.${extension}` + if (basename[0] == '_') { + basename = basename.substring(1); + } + filename = `${basename}.xlsx` } catch(err) { console.log(err); }