import { RouteConfig, NavigationInstruction } from 'aurelia-router';
import { AuthService } from './auth-service';

export class BaseCallback {
  constructor(protected auth: AuthService) {
  }
  canActivate(params: any, routeConfig: RouteConfig, navigationInstruction: NavigationInstruction): boolean | Promise<boolean> {
    // Can only navigate to /callback route when comming from outside the application
    return navigationInstruction == null;
  }
  attached() {
    this.auth.handleAuthentication();
  }
}
