Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { AuthenticationService } from '../../auth/auth.service';
import { environment } from '../../../environments/environment';
@Injectable()
export class IsLoggedInGuard implements CanActivate {
constructor(
private authenticationService: AuthenticationService,
private router: Router
) {}
canActivate(): boolean {
if (
this.authenticationService.getDecodedToken() &&
!this.authenticationService.isTokenExpired()
) {
return true;
}
this.router.navigate(['/']);
}
}