]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/app.component.ts
Client: switch to @nglibs/meta
[github/Chocobozzz/PeerTube.git] / client / src / app / app.component.ts
1 import { Component, OnInit, ViewContainerRef } from '@angular/core';
2 import { Router } from '@angular/router';
3
4 import { AuthService } from './core';
5 import { UserService } from './shared';
6
7 @Component({
8 selector: 'my-app',
9 templateUrl: './app.component.html',
10 styleUrls: [ './app.component.scss' ]
11 })
12 export class AppComponent implements OnInit {
13 notificationOptions = {
14 timeOut: 3000,
15 lastOnBottom: true,
16 clickToClose: true,
17 maxLength: 0,
18 maxStack: 7,
19 showProgressBar: false,
20 pauseOnHover: false,
21 preventDuplicates: false,
22 preventLastDuplicates: 'visible',
23 rtl: false
24 };
25
26 constructor(
27 private router: Router,
28 private authService: AuthService,
29 private userService: UserService,
30 viewContainerRef: ViewContainerRef
31 ) {}
32
33 ngOnInit() {
34 if (this.authService.isLoggedIn()) {
35 // The service will automatically redirect to the login page if the token is not valid anymore
36 this.userService.checkTokenValidity();
37 }
38 }
39
40 isInAdmin() {
41 return this.router.url.indexOf('/admin/') !== -1;
42 }
43 }