Verified Commit 22b16bfa authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix detectInvalidToken in case of empty response

parent cfee4808
......@@ -32,6 +32,7 @@ export class TokenInvalidError extends Error {
const detectInvalidToken = (response) => {
const responseCopy = response.clone();
if (response.status === 403) {
return response.json().then((json) => {
if (response.status === 403) {
const contentLang = response.headers.get('content-language');
......@@ -42,6 +43,8 @@ const detectInvalidToken = (response) => {
}
return responseCopy;
});
}
return Promise.resolve(responseCopy);
};
export const apiRequest = (route, fetchOpts, params) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment