dashboard
repositories
activity
search
login
common
/
securis
summary
reflog
commits
tree
compare
forks
blame
|
history
|
raw
|
HEAD
Merge branch 'angular2' of https://git.curisit.net/gitblit/git/common/secur...
César Calvo
2017-03-15
abb9cc75e166c32cfa97244c497e6a69d14ea114
[common/securis.git]
/
securis
/
src
/
main
/
webapp
/
src
/
app
/
menu.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Observable } from 'rxjs/Observable';
import { BaseRequestOptions, Http } from '@angular/http';
import { Component, ViewChild } from '@angular/core';
import { UserService } from './user.service';
import { Router } from '@angular/router';
import { TdNavigationDrawerComponent } from '@covalent/core'
@Component({
templateUrl: 'src/app/menu.component.html'
})
export class MenuComponent {
@ViewChild('mainMenu') mainMenu: TdNavigationDrawerComponent;
constructor(private userService: UserService,
private router: Router) {
}
ngOnInit(): void {
this.userService.isLoggedIn().subscribe(authOk => {
let isLoggedIn = authOk.valueOf();
if (!isLoggedIn) {
this.router.navigateByUrl('nomenu/login');
}
} ,
err => /* Show message */ this.router.navigateByUrl('nomenu/login'));
}
public closeMenu() {
this.mainMenu.close();
}
}