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