aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-29 21:41:11 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-29 21:41:11 +0100
commit50b0c262fd446e9f57630aa5775e1b4708bdf4cb (patch)
tree8e7a899cb886b2f741546bd8fc2e7084c12deb1e /client/src/app/menu.component.ts
parentf81bb2853cedd7e65859756a5941d5c7e8b3ca2d (diff)
downloadPeerTube-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.ts46
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 @@
1import { Component, OnInit } from '@angular/core';
2import { Router } from '@angular/router';
3
4import { AuthService } from './core';
5import { AuthStatus } from './shared';
6
7@Component({
8 selector: 'my-menu',
9 templateUrl: './menu.component.html'
10})
11export 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}