From 807ee0486a03d6cd1e1ae1d9c6358ce60f83e509 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 22 May 2021 20:28:43 +0200 Subject: [PATCH] Minor improvement --- apps/client/src/app/app.component.ts | 8 +++++--- apps/client/src/app/services/user/user.service.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts index 3daa9004e..f7d5ccff9 100644 --- a/apps/client/src/app/app.component.ts +++ b/apps/client/src/app/app.component.ts @@ -31,7 +31,6 @@ export class AppComponent implements OnDestroy, OnInit { public currentYear = new Date().getFullYear(); public deviceType: string; public info: InfoItem; - public isLoggedIn = false; public user: User; public version = environment.version; @@ -76,9 +75,12 @@ export class AppComponent implements OnDestroy, OnInit { this.user.permissions, permissions.createUserAccount ); - - this.cd.markForCheck(); + } else if (!this.tokenStorageService.getToken()) { + // User has not been logged in + this.user = null; } + + this.cd.markForCheck(); }); } diff --git a/apps/client/src/app/services/user/user.service.ts b/apps/client/src/app/services/user/user.service.ts index ba8a37bb4..0d2df2b69 100644 --- a/apps/client/src/app/services/user/user.service.ts +++ b/apps/client/src/app/services/user/user.service.ts @@ -16,7 +16,7 @@ export class UserService extends ObservableStore { public constructor(private http: HttpClient) { super({ trackStateHistory: true }); - this.setState({ user: null }, 'INIT_STATE'); + this.setState({ user: undefined }, 'INIT_STATE'); } public get() {