【发布时间】:2018-09-25 09:43:50
【问题描述】:
我正在尝试设置一个管道步骤“角色管理”,我需要在其中请求 Web 服务。现在我的问题是,http-request 是异步的,因此永远不会正确触发重定向。
run(routingContext, next){
if (routingContext.getAllInstructions().some(i => i.config.permission)) {
let permission = routingContext.getAllInstructions()[0].config.permission;
this.roleService.userIsAllowedTo(permission)
.then(boolResponse => {
if(boolResponse){
return next();
}else{
return next.cancel(new Redirect("/"));
}
});
}
return next();
}
谁能告诉我如何解决这个问题?
【问题讨论】:
标签: typescript httpclient aurelia