- this.authService.loginChangedSource.subscribe(
- status => {
- if (status === AuthStatus.LoggedIn) {
- this.isLoggedIn = true
- this.user = this.authService.getUser()
-
- this.computeAdminAccess()
- this.computeVideosLink()
-
- logger('Logged in.')
- } else if (status === AuthStatus.LoggedOut) {
- this.isLoggedIn = false
- this.user = undefined
-
- this.computeAdminAccess()
-
- logger('Logged out.')
- } else {
- console.error('Unknown auth status: ' + status)
- }
+ this.isLoggedIn = this.authService.isLoggedIn()
+ this.updateUserState()
+ this.buildMenuSections()
+
+ this.authSub = this.authService.loginChangedSource.subscribe(status => {
+ if (status === AuthStatus.LoggedIn) {
+ this.isLoggedIn = true
+ } else if (status === AuthStatus.LoggedOut) {
+ this.isLoggedIn = false