Аурелия: Как я могу связать переменную с этим маршрутизатором на этапе конвейерной маршрутизации?
Я хотел бы передать пользователя, найденного во времяAuthorizeStep
либоApp class
а затем кhome module
.
Вот что у меня есть:
export class App {
configureRouter(config, router) {
config.addPipelineStep('authorize', AuthorizeStep);
config.map([
{route: ['', ':filter'], name: "", moduleId: 'welcome'}
{route: 'home', name: "home", moduleId: 'home' auth:true}
]);
this.router = router;
}
}
class AuthorizeStep {
run(routingContext, next) {
if (routingContext.nextInstructions.some(i => i.config.auth)) {
this.client.get('auth/login')
.then(response => {
this.user = response.content;
});
}
return next();
}
}