From d14e26d11cd308fadc0e85ab827da51b39416c15 Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Fri, 26 Jul 2024 15:33:56 +0800 Subject: [PATCH] Update --- .../GenerateProjectPandLReport.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/GenerateProjectPandLReport/GenerateProjectPandLReport.tsx b/src/components/GenerateProjectPandLReport/GenerateProjectPandLReport.tsx index f57c222..3f89165 100644 --- a/src/components/GenerateProjectPandLReport/GenerateProjectPandLReport.tsx +++ b/src/components/GenerateProjectPandLReport/GenerateProjectPandLReport.tsx @@ -56,8 +56,16 @@ const GenerateProjectPandLReport: React.FC & SubComponents = ({ projects if (Boolean(query.project) && query.project !== "All") { if(query.project != null && query.startMonth != "" && query.startMonthTo != undefined){ const response = await fetchProjectPandLReport({ projectId: parseFloat(query.project), startMonth: query.startMonth, endMonth: query.startMonthTo }) - if (response) { - downloadFile(new Uint8Array(response.blobValue), response.filename!!) + try{ + if (response) { + downloadFile(new Uint8Array(response.blobValue), response.filename!!) + } + }catch(error){ + errorDialogWithContent(t("Download Fail"), + t(`Please try it later`), t) + .then(() => { + window.location.reload() + }) } }else{ errorDialogWithContent(t("Download Fail"),