Handle invalid tokens
This commit is contained in:
@ -44,6 +44,13 @@ export class APIClient {
|
||||
data = await res.json();
|
||||
else data = await res.blob();
|
||||
|
||||
// Handle expired tokens
|
||||
if (res.status === 412) {
|
||||
AuthApi.RemoveAuthToken();
|
||||
// eslint-disable-next-line no-self-assign
|
||||
window.location.href = window.location.href;
|
||||
}
|
||||
|
||||
if (!args.allowFail && !res.ok)
|
||||
throw new ApiError("Request failed!", res.status, data);
|
||||
|
||||
|
Reference in New Issue
Block a user