10 lines
341 B
TypeScript
10 lines
341 B
TypeScript
import { CanActivateFn } from '@angular/router';
|
|
import { inject } from '@angular/core';
|
|
import { OAuthService } from 'angular-oauth2-oidc';
|
|
|
|
|
|
export const authGuard: CanActivateFn = (route, state) => {
|
|
const authService = inject(OAuthService);
|
|
return authService.hasValidAccessToken(); // returns boolean, Promise, or Observable
|
|
};
|