]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/routing/user-right-guard.service.ts
Update angular
[github/Chocobozzz/PeerTube.git] / client / src / app / core / routing / user-right-guard.service.ts
index 50c3d8c19e59f9c7b412ad2d694230045d3124e1..9f293f6281ca2740ede03977db273eec8303eea2 100644 (file)
@@ -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
   }