| .. | .. |
|---|
| 1 | +import { LocaleService } from './common/i18n'; |
|---|
| 2 | +import { LocalStorageService } from 'angular-2-local-storage'; |
|---|
| 1 | 3 | import { Observable } from 'rxjs/Observable'; |
|---|
| 2 | 4 | import { BaseRequestOptions, Http } from '@angular/http'; |
|---|
| 3 | 5 | import { Component, ViewChild } from '@angular/core'; |
|---|
| 4 | 6 | import { UserService } from './user.service'; |
|---|
| 5 | | -import { Router } from '@angular/router'; |
|---|
| 7 | +import { ActivatedRoute, Router } from '@angular/router'; |
|---|
| 6 | 8 | import { TdNavigationDrawerComponent } from '@covalent/core' |
|---|
| 7 | 9 | |
|---|
| 8 | 10 | |
|---|
| .. | .. |
|---|
| 13 | 15 | |
|---|
| 14 | 16 | @ViewChild('mainMenu') mainMenu: TdNavigationDrawerComponent; |
|---|
| 15 | 17 | |
|---|
| 18 | + userFullName: string; |
|---|
| 16 | 19 | |
|---|
| 17 | 20 | constructor(private userService: UserService, |
|---|
| 21 | + private store: LocalStorageService, |
|---|
| 22 | + private $L: LocaleService, |
|---|
| 23 | + private route: ActivatedRoute, |
|---|
| 18 | 24 | private router: Router) { |
|---|
| 19 | 25 | } |
|---|
| 20 | 26 | |
|---|
| .. | .. |
|---|
| 23 | 29 | let isLoggedIn = authOk.valueOf(); |
|---|
| 24 | 30 | if (!isLoggedIn) { |
|---|
| 25 | 31 | this.router.navigateByUrl('public/login'); |
|---|
| 32 | + this.userFullName = null; |
|---|
| 26 | 33 | } 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"); |
|---|
| 28 | 38 | } |
|---|
| 29 | 39 | } , |
|---|
| 30 | 40 | err => /* Show message */ this.router.navigateByUrl('public/login')); |
|---|