From f24c1fd9c8f04c4eb811211014213c39f529c2d7 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Mon, 26 Aug 2024 02:13:27 +0300 Subject: [PATCH] fix: remove double start token refresh --- src/services/token-refresh.service.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/services/token-refresh.service.ts b/src/services/token-refresh.service.ts index 9ea9ec4..f551967 100644 --- a/src/services/token-refresh.service.ts +++ b/src/services/token-refresh.service.ts @@ -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); }); }