X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frouting%2Fuser-right-guard.service.ts;h=9f293f6281ca2740ede03977db273eec8303eea2;hb=52798aa5f277492d4dd2482bca9396d2e982fa19;hp=50c3d8c19e59f9c7b412ad2d694230045d3124e1;hpb=88108880bbdba473cfe36ecbebc1c3c4f972e102;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..9f293f628 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, RouterStateSnapshot } from '@angular/router' import { AuthService } from '../auth/auth.service' +import { RedirectService } from './redirect.service' @Injectable() -export class UserRightGuard implements CanActivate, CanActivateChild { +export class UserRightGuard { 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 }