mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
fix: handle add message in frontend (#1340)
This commit is contained in:
@ -48,13 +48,12 @@ class PermissionListPage extends BaseListPage {
|
||||
const newPermission = this.newPermission();
|
||||
PermissionBackend.addPermission(newPermission)
|
||||
.then((res) => {
|
||||
if (res.msg !== "") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
if (res.status === "ok") {
|
||||
this.props.history.push({pathname: `/permissions/${newPermission.owner}/${newPermission.name}`, mode: "add"});
|
||||
} else {
|
||||
Setting.showMessage("error", `Permission failed to add: ${res.msg}`);
|
||||
}
|
||||
this.props.history.push({pathname: `/permissions/${newPermission.owner}/${newPermission.name}`, mode: "add"});
|
||||
}
|
||||
)
|
||||
})
|
||||
.catch(error => {
|
||||
Setting.showMessage("error", `Permission failed to add: ${error}`);
|
||||
});
|
||||
|
Reference in New Issue
Block a user