Aurelia [app-router] Error: Expected router pipeline to return a navigation result, but got [{}] instead.(…)

The problem occurs when we do not return a navigation result in the run(context: NavigationContext, next: Function) method in pipeline step. Example below:
import {Router, PipelineStep, NavigationContext} from 'aurelia-router';
export class App {
router: Router;
configureRouter(config, router: Router) {
config.title = 'Vikara';
config.addPipelineStep("authorize", AuthPipelineStep);
config.map([
{ route: ['', 'home'], name: 'home', moduleId: './home/home', nav: true, title: 'Home Page' },
{ route: 'login', name: 'login', moduleId: './login/login', nav: true, title: 'Login' }
]);
this.router = router;
}
}
class AuthPipelineStep implements PipelineStep {
public run(context: NavigationContext, next: Function): void {
// here missing: return next.cancel(); or return next();
}
}

Comments

Post a Comment