2017-08-15 16:39:19 +02:00
|
|
|
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
|
|
|
import {Subscription} from "rxjs/Subscription";
|
|
|
|
|
import {TimerObservable} from "rxjs/observable/TimerObservable";
|
|
|
|
|
|
|
|
|
|
import {KanbanService} from "./kanban/shared/kanban.service";
|
|
|
|
|
|
|
|
|
|
const RENEW_TIMER_INITIAL = 300000;
|
|
|
|
|
const RENEW_TIMER_PERIOD = 300000;
|
2017-08-01 16:33:34 +02:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-root',
|
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
|
styleUrls: ['./app.component.css']
|
|
|
|
|
})
|
2017-08-15 16:39:19 +02:00
|
|
|
export class AppComponent implements OnInit, OnDestroy{
|
2017-08-01 16:33:34 +02:00
|
|
|
title = 'app';
|
2017-08-15 16:39:19 +02:00
|
|
|
authRenewTimer: Subscription;
|
|
|
|
|
|
|
|
|
|
constructor( private kanbanService: KanbanService ) {}
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
|
let timer = TimerObservable.create(RENEW_TIMER_INITIAL, RENEW_TIMER_PERIOD);
|
|
|
|
|
this.authRenewTimer = timer.subscribe(() => {
|
|
|
|
|
this.kanbanService.reload();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ngOnDestroy() {
|
|
|
|
|
this.authRenewTimer.unsubscribe();
|
|
|
|
|
}
|
2017-08-01 16:33:34 +02:00
|
|
|
}
|