refactor: remove log
This commit is contained in:
		| @@ -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")); | ||||
|  | ||||
|   | ||||
| @@ -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'); | ||||
|       }); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user