feat: response with status in casbin_adapter.go (#1384)

* fix: response standardized information with status in `casbin_adapter.go`

* fix: remove redundant statements
This commit is contained in:
imp2002
2022-12-08 10:22:59 +08:00
committed by GitHub
parent 2bb2c36f22
commit e705eecffe
3 changed files with 13 additions and 12 deletions

View File

@ -48,12 +48,14 @@ class AdapterEditPage extends React.Component {
getAdapter() {
AdapterBackend.getAdapter(this.state.owner, this.state.adapterName)
.then((adapter) => {
this.setState({
adapter: adapter,
});
.then((res) => {
if (res.status === "ok") {
this.setState({
adapter: res.data,
});
this.getModels(adapter.owner);
this.getModels(this.adapter.owner);
}
});
}

View File

@ -91,7 +91,7 @@ class PolicyTable extends React.Component {
AdapterBackend.syncPolicies(this.props.owner, this.props.name)
.then((res) => {
if (res.status === "ok") {
this.setState({policyLists: res});
this.setState({policyLists: res.data});
} else {
Setting.showMessage("error", `${i18next.t("adapter:Failed to sync policies")}: ${res.msg}`);
}