我尝试集成HTTP发布请求。我需要将全局变量的默认值更改为发布请求的响应。
getPermissions(permissions: PermissionParam): Observable<any> {
console.log('Get permissions', permissions);
const permisions_data = JSON.stringify(permissions)
return this.http.post(this.permission_url, permisions_data, {headers: {'Content-Type': 'application/json'}});
}
isPermission(data) {
this.permissionService.getPermissions(data).subscribe(res => {
this.permission = res.status // this.permission = false in default as global varible
},
// tslint:disable-next-line:no-shadowed-variable
error => {
const error_data = JSON.stringify(error);
console.log(error.error.Message);
});
console.log(this.have_permision)
}