César Calvo
2017-03-14 5621e8341def5afd7b72e134c054f74e6e6ee895
securis/src/main/webapp/src/app/home.component.ts
....@@ -22,7 +22,7 @@
2222 @ViewChild('mainMenu') mainMenu: TdNavigationDrawerComponent;
2323
2424 securisVersion : string;
25
- showMenu : boolean = false;
25
+ isLoggedIn : boolean = false;
2626
2727 constructor(private userService: UserService,
2828 toaster: ToastsManager,
....@@ -60,13 +60,15 @@
6060 this.mainMenu.close();
6161 }
6262
63
- ngAfterViewInit(): void {
64
- // this.showMenu = true;
65
- this.media.broadcast();
63
+ ngOnInit(): void {
6664 this.userService.isLoggedIn().subscribe(authOk => {
67
- //this.showMenu = authOk.valueOf();
68
- this.router.navigateByUrl(authOk ? 'packs' : 'login');
69
- },
70
- err => /* Show message */ this.router.navigateByUrl('login'));
65
+ this.isLoggedIn = true//authOk.valueOf();
66
+ this.router.navigateByUrl(this.isLoggedIn ? 'packs' : 'login');
67
+ } ,
68
+ err => /* Show message */ this.router.navigateByUrl('login'));
69
+ }
70
+
71
+ ngAfterViewInit(): void {
72
+ this.media.broadcast();
7173 }
7274 }