HM-86. Включена проверка токенов для api, фикс фронта
This commit is contained in:
@ -66,17 +66,15 @@ class HttpAuthApi {
|
||||
errorHandling = (error, resolve, reject, requestConfig) => {
|
||||
if (error.response.status === 401) {
|
||||
this.isPendingRefresh = true;
|
||||
this.pendingRequests({resolve, reject, requestConfig});
|
||||
this.pendingRequests.push({resolve, reject, requestConfig});
|
||||
authServiceApi.refresh()
|
||||
.then(() => {
|
||||
this.repeatRequests();
|
||||
})
|
||||
.catch((refreshError) => {
|
||||
this.rejectRequests(refreshError);
|
||||
/*
|
||||
* Снять авторизацию и сделать роут
|
||||
* Сбросить все запросы с ошибкой авторизации
|
||||
*/
|
||||
tokenApi.clearTokents();
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
reject(error);
|
||||
|
||||
Reference in New Issue
Block a user