pdnsmanager/frontend/src/app/app.component.ts

27 lines
847 B
TypeScript
Raw Normal View History

2018-04-29 19:40:57 +02:00
import { UpdateOperation } from './operations/update.operations';
2018-04-08 13:02:00 +02:00
import { Router } from '@angular/router';
2018-04-29 19:40:57 +02:00
import { Component, OnInit } from '@angular/core';
2018-04-08 13:02:00 +02:00
import { StateService } from './services/state.service';
import { SessionOperation } from './operations/session.operation';
@Component({
2018-04-29 19:40:57 +02:00
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
2018-04-08 13:02:00 +02:00
})
2018-04-29 19:40:57 +02:00
export class AppComponent implements OnInit {
2018-04-08 13:02:00 +02:00
2018-04-29 19:40:57 +02:00
constructor(public gs: StateService, private session: SessionOperation, private router: Router, private update: UpdateOperation) { }
2018-04-08 13:02:00 +02:00
2018-04-29 19:40:57 +02:00
async ngOnInit() {
if (await this.update.updateRequired()) {
this.router.navigate(['/update']);
}
}
public async onLogout() {
await this.session.logout();
this.router.navigate(['/logout']);
}
2018-04-08 13:02:00 +02:00
}