fix: remove double start token refresh

This commit is contained in:
Polianin Nikita 2024-08-26 02:13:27 +03:00
parent c945a1016b
commit f24c1fd9c8

View File

@ -19,9 +19,6 @@ export class TokenRefreshService {
private startTokenRefresh(): void {
this.refreshTokenTimeout = setTimeout(() => {
this.refreshToken();
if (this.refreshTokenExpireMs > 0)
this.startTokenRefresh();
}, this.refreshTokenExpireMs);
}
@ -36,7 +33,6 @@ export class TokenRefreshService {
catchError(error => {
if (error.status === 403 || error.status === 401 || !localStorage.getItem(ApiService.tokenKey)) {
localStorage.removeItem(ApiService.tokenKey);
this.refreshTokenExpireMs = -1;
return of(undefined);
}
@ -56,6 +52,7 @@ export class TokenRefreshService {
.subscribe(data => {
if (data)
this.setRefreshTokenExpireMs(data);
this.tokenRefreshing$.next(false);
});
}