fix: remove double start token refresh
This commit is contained in:
		| @@ -19,9 +19,6 @@ export class TokenRefreshService { | |||||||
|   private startTokenRefresh(): void { |   private startTokenRefresh(): void { | ||||||
|     this.refreshTokenTimeout = setTimeout(() => { |     this.refreshTokenTimeout = setTimeout(() => { | ||||||
|       this.refreshToken(); |       this.refreshToken(); | ||||||
|  |  | ||||||
|       if (this.refreshTokenExpireMs > 0) |  | ||||||
|         this.startTokenRefresh(); |  | ||||||
|     }, this.refreshTokenExpireMs); |     }, this.refreshTokenExpireMs); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -36,7 +33,6 @@ export class TokenRefreshService { | |||||||
|         catchError(error => { |         catchError(error => { | ||||||
|           if (error.status === 403 || error.status === 401 || !localStorage.getItem(ApiService.tokenKey)) { |           if (error.status === 403 || error.status === 401 || !localStorage.getItem(ApiService.tokenKey)) { | ||||||
|             localStorage.removeItem(ApiService.tokenKey); |             localStorage.removeItem(ApiService.tokenKey); | ||||||
|             this.refreshTokenExpireMs = -1; |  | ||||||
|             return of(undefined); |             return of(undefined); | ||||||
|           } |           } | ||||||
|  |  | ||||||
| @@ -56,6 +52,7 @@ export class TokenRefreshService { | |||||||
|       .subscribe(data => { |       .subscribe(data => { | ||||||
|         if (data) |         if (data) | ||||||
|           this.setRefreshTokenExpireMs(data); |           this.setRefreshTokenExpireMs(data); | ||||||
|  |  | ||||||
|         this.tokenRefreshing$.next(false); |         this.tokenRefreshing$.next(false); | ||||||
|       }); |       }); | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user