This commit is contained in:
@@ -137,11 +137,18 @@ 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);
|
||||||
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user