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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
thank you this was helpful!
ReplyDeleteGreat to know that :)
DeleteThanks, that resolved my head-banger of the hour
ReplyDelete