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