“我要创建一个项目,但是我的代码中出现httpresponse错误,我该怎么办?”
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
const config: AllowedActionsGuardConfig = route.data['AllowedActionsGuardConfig'];
if (this.authService.currentUser.hasAllowedUserRoleAction(config.AllowedActions)) {
this.router.navigate([
`${!config.AbsolutePath ? state.url : ''}${config.NavigateToOnAuthorized}`,
]);
return true;
} else {
this.router.navigate([
`${!config.AbsolutePath ? state.url : ''}${config.FallbackOnUnauthorized}`,
]);
return false;
}
}