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) => { 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);