fix: unsubscribe from listening to refresh token

This commit is contained in:
2024-08-26 01:24:57 +03:00
parent 5d79d86c44
commit 60d306f9c9
2 changed files with 6 additions and 6 deletions

View File

@ -26,23 +26,21 @@ export class TokenRefreshService {
}
private refreshToken(): void {
if (this.tokenRefreshing$.value) {
if (this.tokenRefreshing$.value)
return;
}
this.tokenRefreshing$.next(true);
this.authService.refreshToken()
.pipe(
catchError(error => {
catchError(_ => {
localStorage.removeItem(ApiService.tokenKey);
this.refreshTokenExpireMs = -1;
return of(undefined);
}))
.subscribe(data => {
if (data) {
if (data)
this.setRefreshTokenExpireMs(data);
}
this.tokenRefreshing$.next(false);
});
}