Added slices
Change-Id: I9dfaa9348fa82da844a04c0c2a58ce07e9fa3a28
diff --git a/src/app/directives/protected.directive.ts b/src/app/directives/protected.directive.ts
index 9ebe89e..8eac4fd 100644
--- a/src/app/directives/protected.directive.ts
+++ b/src/app/directives/protected.directive.ts
@@ -6,24 +6,16 @@
import {Router} from '@angular/router';
@Directive({
- selector: '[xos-protected]',
+ selector: '[xosProtected]',
providers: [AuthService]
})
export class ProtectedDirective implements OnDestroy {
- private sub:any = null;
- constructor(private authService:AuthService, private router:Router) {
- console.log('protected directive');
- if (!authService.isAuthenticated()) {
- console.log('redirect');
+ constructor(private authService: AuthService, private router: Router) {
+ if (!this.authService.isAuthenticated()) {
this.router.navigate(['/login']);
}
-
- // this.sub = this.authService.subscribe((val) => {
- // if (!val.authenticated) {
- // this.router.navigate(['LoggedoutPage']); // tells them they've been logged out (somehow)
- // }
- // });
+ // TODO listen for logout
}
ngOnDestroy() {