rsanchez
2017-03-19 280daa7f3f858ecfef9c91ffd5dea1007f021048
securis/src/main/webapp/src/app/menu.component.ts
....@@ -1,8 +1,10 @@
1
+import { LocaleService } from './common/i18n';
2
+import { LocalStorageService } from 'angular-2-local-storage';
13 import { Observable } from 'rxjs/Observable';
24 import { BaseRequestOptions, Http } from '@angular/http';
35 import { Component, ViewChild } from '@angular/core';
46 import { UserService } from './user.service';
5
-import { Router } from '@angular/router';
7
+import { ActivatedRoute, Router } from '@angular/router';
68 import { TdNavigationDrawerComponent } from '@covalent/core'
79
810
....@@ -13,8 +15,12 @@
1315
1416 @ViewChild('mainMenu') mainMenu: TdNavigationDrawerComponent;
1517
18
+ userFullName: string;
1619
1720 constructor(private userService: UserService,
21
+ private store: LocalStorageService,
22
+ private $L: LocaleService,
23
+ private route: ActivatedRoute,
1824 private router: Router) {
1925 }
2026
....@@ -23,8 +29,12 @@
2329 let isLoggedIn = authOk.valueOf();
2430 if (!isLoggedIn) {
2531 this.router.navigateByUrl('public/login');
32
+ this.userFullName = null;
2633 } else {
27
- this.router.navigate(['packs']);
34
+ if (this.route.firstChild == null) {
35
+ this.router.navigate(['packs']);
36
+ }
37
+ this.userFullName = this.store.get<string>("user_full_name");
2838 }
2939 } ,
3040 err => /* Show message */ this.router.navigateByUrl('public/login'));