mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
add inactivity page
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class InactivityGuard implements CanActivate {
|
||||
|
||||
constructor(
|
||||
private router:Router
|
||||
){}
|
||||
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
alert(SessionStore.exist+ ' '+SessionStore.user.Inativity+ ' '+ SessionStore.hasPin)
|
||||
if(SessionStore.exist && SessionStore.user.Inativity && !SessionStore.hasPin) {
|
||||
alert('stay set pin')
|
||||
return true
|
||||
|
||||
} else if(SessionStore.exist && SessionStore.user.Inativity) {
|
||||
alert('stay cofirm')
|
||||
return true
|
||||
} else {
|
||||
alert('goint')
|
||||
this.router.navigate(['/home/events']);
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user