1 import { Injectable } from '@angular/core';
2 import { CanActivate, CanActivateChild, Router } from '@angular/router';
4 import { AuthStorageService } from './auth-storage.service';
9 export class AuthGuardService implements CanActivate, CanActivateChild {
10 constructor(private router: Router, private authStorageService: AuthStorageService) {}
13 if (this.authStorageService.isLoggedIn()) {
16 this.router.navigate(['/login']);
20 canActivateChild(): boolean {
21 return this.canActivate();