aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index f487e6c48..47d2bfdd2 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,14 +1,17 @@
1import { Component, ViewContainerRef } from '@angular/core'; 1import { Component, OnInit, ViewContainerRef } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { MetaService } from 'ng2-meta'; 4import { MetaService } from 'ng2-meta';
5
6import { AuthService } from './core';
7import { UserService } from './shared';
8
5@Component({ 9@Component({
6 selector: 'my-app', 10 selector: 'my-app',
7 templateUrl: './app.component.html', 11 templateUrl: './app.component.html',
8 styleUrls: [ './app.component.scss' ] 12 styleUrls: [ './app.component.scss' ]
9}) 13})
10 14export class AppComponent implements OnInit {
11export class AppComponent {
12 notificationOptions = { 15 notificationOptions = {
13 timeOut: 3000, 16 timeOut: 3000,
14 lastOnBottom: true, 17 lastOnBottom: true,
@@ -25,9 +28,18 @@ export class AppComponent {
25 constructor( 28 constructor(
26 private router: Router, 29 private router: Router,
27 private metaService: MetaService, 30 private metaService: MetaService,
31 private authService: AuthService,
32 private userService: UserService,
28 viewContainerRef: ViewContainerRef 33 viewContainerRef: ViewContainerRef
29 ) {} 34 ) {}
30 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
31 isInAdmin() { 43 isInAdmin() {
32 return this.router.url.indexOf('/admin/') !== -1; 44 return this.router.url.indexOf('/admin/') !== -1;
33 } 45 }