1 import { Injectable } from '@angular/core'
2 import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'
3 import { AuthService } from '../auth/auth.service'
4 import { RedirectService } from './redirect.service'
7 export class UnloggedGuard {
10 private auth: AuthService,
11 private redirectService: RedirectService
14 canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
15 if (this.auth.isLoggedIn() === false) return true
17 this.redirectService.redirectToHomepage()
21 canActivateChild (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
22 return this.canActivate(route, state)