1 import { Component, OnInit } from '@angular/core'
2 import { Router } from '@angular/router'
3 import { AuthService, ServerService } from './core'
7 templateUrl: './app.component.html',
8 styleUrls: [ './app.component.scss' ]
10 export class AppComponent implements OnInit {
11 notificationOptions = {
17 showProgressBar: false,
19 preventDuplicates: false,
20 preventLastDuplicates: 'visible',
24 isMenuDisplayed = true
27 private router: Router,
28 private authService: AuthService,
29 private serverService: ServerService
33 this.authService.loadClientCredentials()
35 if (this.authService.isLoggedIn()) {
36 // The service will automatically redirect to the login page if the token is not valid anymore
37 this.authService.refreshUserInformation()
40 // Load custom data from server
41 this.serverService.loadConfig()
42 this.serverService.loadVideoCategories()
43 this.serverService.loadVideoLanguages()
44 this.serverService.loadVideoLicences()
45 this.serverService.loadVideoPrivacies()
47 // Do not display menu on small screens
48 if (window.innerWidth < 600) {
49 this.isMenuDisplayed = false
54 return this.router.url.indexOf('/admin/') !== -1
59 this.isMenuDisplayed = !this.isMenuDisplayed
62 getMainColClasses () {
63 // Take all width is the menu is not displayed
64 if (this.isMenuDisplayed === false) return [ 'expanded' ]