From 39ffa5e52c801d3d3da885d38b7c4777575d629f Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Sun, 14 May 2023 21:17:56 +0200 Subject: [PATCH] Fix issue on login where user info would not be displayed properly --- src/app/pages/admin/admin.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/pages/admin/admin.component.ts b/src/app/pages/admin/admin.component.ts index 8c677b6..c0ce831 100644 --- a/src/app/pages/admin/admin.component.ts +++ b/src/app/pages/admin/admin.component.ts @@ -137,11 +137,18 @@ export class AdminComponent implements OnInit { login(): void { this.api.login(this.email, this.password).subscribe((session: Session): void => { - console.log(session); if(session.sessionId != null && session.sessionId !== -1) { UtilsService.saveSessionInfoToLocalStorage(session.sessionId, session.sessionKey); - this.isLoggedIn = true; - this.getEvents(); + + // Get user info + this.api.checkSession(UtilsService.getSessionInfoFromLocalStorage()).subscribe((user: User) => { + if(user.userId != null && user.userId !== -1) { + this.isLoggedIn = true; + this.name = user.fullName; + this.isActive = user.isActive; + this.getEvents(); + } + }); } }); }