X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frouting%2Fuser-right-guard.service.ts;h=c6bd05bb695cab301b04188c88d8b2a35a5fef7f;hb=15825ef18d3b2bb74f4e613496cf3e2921a87389;hp=50c3d8c19e59f9c7b412ad2d694230045d3124e1;hpb=73471b1a52f242e86364ffb077ea6cadb3b07ae2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/routing/user-right-guard.service.ts b/client/src/app/core/routing/user-right-guard.service.ts index 50c3d8c19..c6bd05bb6 100644 --- a/client/src/app/core/routing/user-right-guard.service.ts +++ b/client/src/app/core/routing/user-right-guard.service.ts @@ -1,19 +1,13 @@ import { Injectable } from '@angular/core' -import { - ActivatedRouteSnapshot, - CanActivateChild, - RouterStateSnapshot, - CanActivate, - Router -} from '@angular/router' - +import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router' import { AuthService } from '../auth/auth.service' +import { RedirectService } from './redirect.service' @Injectable() export class UserRightGuard implements CanActivate, CanActivateChild { constructor ( - private router: Router, + private redirectService: RedirectService, private auth: AuthService ) {} @@ -25,7 +19,7 @@ export class UserRightGuard implements CanActivate, CanActivateChild { if (user.hasRight(neededUserRight)) return true } - this.router.navigate([ '/login' ]) + this.redirectService.redirectToLogin() return false }