1 import { Component, OnInit, ViewContainerRef } from '@angular/core';
2 import { Router } from '@angular/router';
4 import { MetaService } from 'ng2-meta';
6 import { AuthService } from './core';
7 import { UserService } from './shared';
11 templateUrl: './app.component.html',
12 styleUrls: [ './app.component.scss' ]
14 export class AppComponent implements OnInit {
15 notificationOptions = {
21 showProgressBar: false,
23 preventDuplicates: false,
24 preventLastDuplicates: 'visible',
29 private router: Router,
30 private metaService: MetaService,
31 private authService: AuthService,
32 private userService: UserService,
33 viewContainerRef: ViewContainerRef
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();
44 return this.router.url.indexOf('/admin/') !== -1;