Fix issue on login where user info would not be displayed properly
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2023-05-14 21:17:56 +02:00
parent 9ed6f9968e
commit 39ffa5e52c
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE

View File

@ -137,14 +137,21 @@ export class AdminComponent implements OnInit {
login(): void { login(): void {
this.api.login(this.email, this.password).subscribe((session: Session): void => { this.api.login(this.email, this.password).subscribe((session: Session): void => {
console.log(session);
if(session.sessionId != null && session.sessionId !== -1) { if(session.sessionId != null && session.sessionId !== -1) {
UtilsService.saveSessionInfoToLocalStorage(session.sessionId, session.sessionKey); UtilsService.saveSessionInfoToLocalStorage(session.sessionId, session.sessionKey);
// Get user info
this.api.checkSession(UtilsService.getSessionInfoFromLocalStorage()).subscribe((user: User) => {
if(user.userId != null && user.userId !== -1) {
this.isLoggedIn = true; this.isLoggedIn = true;
this.name = user.fullName;
this.isActive = user.isActive;
this.getEvents(); this.getEvents();
} }
}); });
} }
});
}
register(): void { register(): void {
this.api.register(this.registerEmail, this.name, this.registerPassword).subscribe((session: Session): void => { this.api.register(this.registerEmail, this.name, this.registerPassword).subscribe((session: Session): void => {