X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frouting%2Flogin-guard.service.ts;h=ecb902625bfa2a7248333da735413ec956a34e52;hb=cf0eff397215ff18610eab51723819b2f13a3e25;hp=18bc41ca6301e9e8811f851dbd3c7cf256b33356;hpb=954605a804da399317ca62afa2fb9244afa11ebf;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/routing/login-guard.service.ts b/client/src/app/core/routing/login-guard.service.ts index 18bc41ca6..ecb902625 100644 --- a/client/src/app/core/routing/login-guard.service.ts +++ b/client/src/app/core/routing/login-guard.service.ts @@ -1,26 +1,20 @@ import { Injectable } from '@angular/core' -import { - ActivatedRouteSnapshot, - CanActivateChild, - RouterStateSnapshot, - CanActivate, - Router -} from '@angular/router' - +import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router' import { AuthService } from '../auth/auth.service' +import { RedirectService } from './redirect.service' @Injectable() -export class LoginGuard implements CanActivate, CanActivateChild { +export class LoginGuard { constructor ( - private router: Router, - private auth: AuthService + private auth: AuthService, + private redirectService: RedirectService ) {} canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (this.auth.isLoggedIn() === true) return true - this.router.navigate([ '/login' ]) + this.redirectService.redirectToLogin() return false }