time out
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { BnNgIdleService } from 'bn-ng-idle';
|
||||
import {SessionDataProviderService} from "./store/session-data-provider.service";
|
||||
import {Router} from "@angular/router"; // import it to your component
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -6,8 +9,16 @@ import { Component } from '@angular/core';
|
||||
styleUrls: ['app.component.scss'],
|
||||
})
|
||||
export class AppComponent {
|
||||
constructor() {
|
||||
constructor(private bnIdle: BnNgIdleService,private sessionDataProviderService : SessionDataProviderService, public router: Router) {
|
||||
// this.OneSignalInit();
|
||||
this.bnIdle.startWatching(300).subscribe((res) => {
|
||||
if(res) {
|
||||
console.log("session expired");
|
||||
// alert('LOG OUT NOW');
|
||||
this.sessionDataProviderService.DestroySessionOnLogout();
|
||||
this.router.navigate(['login']);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Call this function when your app starts
|
||||
|
||||
Reference in New Issue
Block a user