123456789101112131415161718192021 |
- import { AuthServiceService } from './auth-service.service';
- import { Injectable } from '@angular/core';
- import { Router, CanActivate } from '@angular/router';
- @Injectable({
- providedIn: 'root'
- })
- export class AuthGuardService {
- constructor(public auth: AuthServiceService, public router: Router) {}
- canActivate(): boolean {
- if (this.auth.isAuthenticated()) {
- this.router.navigate(['/InternalPage/home']);
- return false;
- }
- return true;
- }
- }
|