regionedu.auth.guard.ts 462 Bytes
Newer Older
Open Source Developer's avatar
trans    
Open Source Developer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { PDE_ROLE } from '../constants';

@Injectable()
export default class RegionEduAuthGuard implements CanActivate {

  constructor(private authService: AuthService) {}

  canActivate() {
    return this.authService.isLoggedIn(PDE_ROLE).then(loggedIn => {return loggedIn;}).catch(err => {return false;});
  }
}