From 87cd95c8428ebdbe61e55ee25c5b365b3db8f03d Mon Sep 17 00:00:00 2001 From: Vu Khanh Du Date: Thu, 1 Feb 2024 16:37:50 +0700 Subject: [PATCH] fix: show error when call api failed --- cope2n-fe/src/request/report.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cope2n-fe/src/request/report.ts b/cope2n-fe/src/request/report.ts index 0d386ee..d068283 100644 --- a/cope2n-fe/src/request/report.ts +++ b/cope2n-fe/src/request/report.ts @@ -1,3 +1,4 @@ +import { notification } from 'antd'; import { MakeReportParams, MakeReportResponse, @@ -22,6 +23,9 @@ export async function getReportDetailList(params: ReportDetailListParams) { ); return response.data; } catch (error) { + notification.error({ + message: `${error?.message}`, + }); console.log(error); } } @@ -38,6 +42,9 @@ export async function makeReport(params: MakeReportParams) { }); return response.data; } catch (error) { + notification.error({ + message: `${error?.message}`, + }); console.log(error); } } @@ -54,6 +61,9 @@ export async function getReportList(params?: ReportListParams) { }); return response.data; } catch (error) { + notification.error({ + message: `${error?.message}`, + }); console.log(error); } } @@ -71,6 +81,9 @@ export async function getOverViewReport(params?: ReportListParams) { }); return response.data; } catch (error) { + notification.error({ + message: `${error?.message}`, + }); console.log(error); } } @@ -87,6 +100,9 @@ export async function downloadReport(report_id: string) { // window.open(fileURL); return file; } catch (error) { + notification.error({ + message: `${error?.message}`, + }); console.log(error); } }