From 615ec6893115af843a9cc8f94b3f919f4e7d4418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 12 May 2024 19:52:16 +0200 Subject: [PATCH] Fix error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/api/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/index.ts b/src/api/index.ts index d385131f5..512bfd835 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -99,7 +99,10 @@ export const getFetch = (accessToken?: string | null, baseURL: string = '') => // } - if (!response.ok) throw { response: { ...response, data, json } }; + if (!response.ok) { + const { headers, ok, redirected, status, statusText, type, url } = response; + throw { response: { headers, ok, redirected, status, statusText, type, url, data, json } }; + } return { ...response, data, json }; }); };