mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
feat: replace all panic by response err (#1993)
* fix: missing return after response error * feat: handle error in frontend * feat: disable loading and catch org edit error * chore: i18 for error message * chore: remove break line * feat: application catching error
This commit is contained in:
@ -42,18 +42,22 @@ class RoleEditPage extends React.Component {
|
||||
|
||||
getRole() {
|
||||
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
||||
.then((role) => {
|
||||
if (role === null) {
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
role: role,
|
||||
role: res,
|
||||
});
|
||||
|
||||
this.getUsers(role.owner);
|
||||
this.getRoles(role.owner);
|
||||
this.getUsers(res.owner);
|
||||
this.getRoles(res.owner);
|
||||
});
|
||||
}
|
||||
|
||||
@ -69,6 +73,10 @@ class RoleEditPage extends React.Component {
|
||||
getUsers(organizationName) {
|
||||
UserBackend.getUsers(organizationName)
|
||||
.then((res) => {
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
users: res,
|
||||
});
|
||||
@ -78,6 +86,10 @@ class RoleEditPage extends React.Component {
|
||||
getRoles(organizationName) {
|
||||
RoleBackend.getRoles(organizationName)
|
||||
.then((res) => {
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
roles: res,
|
||||
});
|
||||
|
Reference in New Issue
Block a user