From d7349afd6badb443c43ba2442a9ad5f5df049281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Wed, 1 Sep 2021 10:31:56 +0500 Subject: [PATCH] fix factory.download. Starts download only if response status is 200 --- src/components/factory.ts | 4 +++- src/styles/grid.css | 25 ------------------------- 2 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 src/styles/grid.css diff --git a/src/components/factory.ts b/src/components/factory.ts index ca0bd9d..7967934 100644 --- a/src/components/factory.ts +++ b/src/components/factory.ts @@ -37,7 +37,7 @@ export const invokeWebApiWrapperAsync = async (funcAsync: asyncFunction, setShow await funcAsync() } catch (ex) { if(process.env.NODE_ENV === 'development') - console.log(ex) + console.error(ex) if(errorNotifyText) notify(errorNotifyText, 'error') } finally{ @@ -53,6 +53,8 @@ export const download = async (url:string, fileName?:string) => { }, method: 'Get' }) + if(response.status !== 200) + throw response const requestFileName = decodeURI(fileName ??response.headers .get('content-disposition') diff --git a/src/styles/grid.css b/src/styles/grid.css deleted file mode 100644 index b1bfcac..0000000 --- a/src/styles/grid.css +++ /dev/null @@ -1,25 +0,0 @@ -.grid_container{ - display: grid; - column-gap: 4px; - row-gap: 4px; - justify-items: stretch; - align-items: stretch; -} - -.c1{ grid-column: 1 / span 1; } -.c2{ grid-column: 2 / span 1; } -.c3{ grid-column: 3 / span 1; } -.c4{ grid-column: 4 / span 1; } -.c5{ grid-column: 5 / span 1; } -.c6{ grid-column: 6 / span 1; } -.c7{ grid-column: 7 / span 1; } -.c8{ grid-column: 8 / span 1; } - -.r1{ grid-row: 1 / span 1; } -.r2{ grid-row: 2 / span 1; } -.r3{ grid-row: 3 / span 1; } -.r4{ grid-row: 4 / span 1; } -.r5{ grid-row: 5 / span 1; } -.r6{ grid-row: 6 / span 1; } -.r7{ grid-row: 7 / span 1; } -.r8{ grid-row: 8 / span 1; } \ No newline at end of file