diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-29 21:41:11 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-29 21:41:11 +0100 |
commit | 50b0c262fd446e9f57630aa5775e1b4708bdf4cb (patch) | |
tree | 8e7a899cb886b2f741546bd8fc2e7084c12deb1e /client/src/app/menu.component.ts | |
parent | f81bb2853cedd7e65859756a5941d5c7e8b3ca2d (diff) | |
download | PeerTube-50b0c262fd446e9f57630aa5775e1b4708bdf4cb.tar.gz PeerTube-50b0c262fd446e9f57630aa5775e1b4708bdf4cb.tar.zst PeerTube-50b0c262fd446e9f57630aa5775e1b4708bdf4cb.zip |
Client: move menu component in core module
Diffstat (limited to 'client/src/app/menu.component.ts')
-rw-r--r-- | client/src/app/menu.component.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/client/src/app/menu.component.ts b/client/src/app/menu.component.ts deleted file mode 100644 index d1a1d51e7..000000000 --- a/client/src/app/menu.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | ||
2 | import { Router } from '@angular/router'; | ||
3 | |||
4 | import { AuthService } from './core'; | ||
5 | import { AuthStatus } from './shared'; | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-menu', | ||
9 | templateUrl: './menu.component.html' | ||
10 | }) | ||
11 | export class MenuComponent implements OnInit { | ||
12 | isLoggedIn: boolean; | ||
13 | |||
14 | constructor ( | ||
15 | private authService: AuthService, | ||
16 | private router: Router | ||
17 | ) {} | ||
18 | |||
19 | ngOnInit() { | ||
20 | this.isLoggedIn = this.authService.isLoggedIn(); | ||
21 | |||
22 | this.authService.loginChangedSource.subscribe( | ||
23 | status => { | ||
24 | if (status === AuthStatus.LoggedIn) { | ||
25 | this.isLoggedIn = true; | ||
26 | console.log('Logged in.'); | ||
27 | } else if (status === AuthStatus.LoggedOut) { | ||
28 | this.isLoggedIn = false; | ||
29 | console.log('Logged out.'); | ||
30 | } else { | ||
31 | console.error('Unknown auth status: ' + status); | ||
32 | } | ||
33 | } | ||
34 | ); | ||
35 | } | ||
36 | |||
37 | isUserAdmin() { | ||
38 | return this.authService.isAdmin(); | ||
39 | } | ||
40 | |||
41 | logout() { | ||
42 | this.authService.logout(); | ||
43 | // Redirect to home page | ||
44 | this.router.navigate(['/videos/list']); | ||
45 | } | ||
46 | } | ||