I’m trying to setup a pipeline step “role management” where I need to request the web service. Now my problem is, that the http-request is asynchonious and so the redirect is never triggered correctly.
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();
}
Can someone show me how to solve that?