refactor: remove log

This commit is contained in:
Polianin Nikita 2024-08-24 04:28:23 +03:00
parent 1f03c2a9c3
commit b215d8909c
2 changed files with 1 additions and 7 deletions

View File

@ -57,7 +57,6 @@ export class AuthService {
public refreshToken(): Observable<Date> {
const token = localStorage.getItem(ApiService.tokenKey);
console.log(token);
if (!token)
return throwError(() => new Error("Token is not found"));

View File

@ -1,4 +1,4 @@
import {BehaviorSubject, catchError, of, Subject, Subscription} from "rxjs";
import {BehaviorSubject, catchError, of, Subject} from "rxjs";
import {Injectable} from "@angular/core";
import {AuthService} from "@service/auth.service";
import {environment} from "@environment";
@ -27,28 +27,23 @@ export class TokenRefreshService {
private refreshToken(): void {
if (this.tokenRefreshing$.value) {
console.warn('Refreshing token was started...');
return;
}
console.log('Start Refreshing token...');
this.tokenRefreshing$.next(true);
this.authService.refreshToken()
.pipe(
catchError(error => {
console.warn('Error refreshing token', error);
localStorage.removeItem(ApiService.tokenKey);
this.refreshTokenExpireMs = -1;
return of(undefined);
}))
.subscribe(data => {
if (data) {
console.log('Token refreshed');
this.setRefreshTokenExpireMs(data);
}
this.tokenRefreshing$.next(false);
console.log('Token refresh process completed');
});
}