HM-86. Включена проверка токенов для api, фикс фронта

This commit is contained in:
2020-08-04 22:54:00 +03:00
parent 4b31c34b5b
commit ca94ece2b3

View File

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