auth guard
// src/app/auth/auth.service.tsimport { Injectable } from '@angular/core';import { JwtHelperService } from '@auth0/angular-jwt';@Injectable()export class AuthService { constructor(public jwtHelper: JwtHelperService) {} // ... public isAuthenticated(): boolean { const token = localStorage.getItem('token'); // Check whether the token is expired and return // true or false return !this.jwtHelper.isTokenExpired(token); }}
Are there any code examples left?
New code examples in category Other