Fix error handling

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-12 19:52:16 +02:00
parent ec918d497d
commit 615ec68931

View File

@ -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 };
});
};