From 968d5e70dbda71ec2e9c78008f58f7e66a5d0479 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Dec 2020 21:09:15 +0100 Subject: [PATCH] Fix loggedIn prop in AuthService --- src/app/services/auth.service.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index a77a8ba..d53810f 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -13,8 +13,6 @@ export class AuthService { private currentUserSubject: BehaviorSubject; public currentUser: Observable; public loggedIn: BehaviorSubject; - private readonly REQUEST_TOKEN = 'requestToken'; - private readonly REFRESH_TOKEN = 'refreshToken'; private readonly CURRENT_USER = 'currentUser'; constructor(private http: HttpClient) { @@ -38,7 +36,7 @@ export class AuthService { } private checkIfUserIsLoggedIn(): void { - this.loggedIn.next(!!this.getRequestToken()); + this.loggedIn.next(!!localStorage.getItem(this.CURRENT_USER)); } public getRequestToken(): string { @@ -74,6 +72,7 @@ export class AuthService { finalize(() => { this.removeTokens(); this.checkIfUserIsLoggedIn(); + }) ); }