mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: fix response data assignment error (#2123)
This commit is contained in:
parent
3c4112dd44
commit
577bd6ce58
@ -94,11 +94,10 @@ func (c *ApiController) GetPlan() {
|
||||
plan.Options = append(plan.Options, option.DisplayName)
|
||||
}
|
||||
|
||||
c.Data["json"] = plan
|
||||
c.ResponseOk(plan)
|
||||
} else {
|
||||
c.Data["json"] = plan
|
||||
c.ResponseOk(plan)
|
||||
}
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
// UpdatePlan
|
||||
|
@ -88,8 +88,7 @@ func (c *ApiController) GetProduct() {
|
||||
return
|
||||
}
|
||||
|
||||
c.Data["json"] = product
|
||||
c.ServeJSON()
|
||||
c.ResponseOk(product)
|
||||
}
|
||||
|
||||
// UpdateProduct
|
||||
|
@ -129,19 +129,20 @@ class ApplicationEditPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.grantTypes === null || res.grantTypes === undefined || res.grantTypes.length === 0) {
|
||||
res.grantTypes = ["authorization_code"];
|
||||
const application = res.data;
|
||||
if (application.grantTypes === null || application.grantTypes === undefined || application.grantTypes.length === 0) {
|
||||
application.grantTypes = ["authorization_code"];
|
||||
}
|
||||
|
||||
if (res.tags === null || res.tags === undefined) {
|
||||
res.tags = [];
|
||||
if (application.tags === null || application.tags === undefined) {
|
||||
application.tags = [];
|
||||
}
|
||||
|
||||
this.setState({
|
||||
application: res.data,
|
||||
application: application,
|
||||
});
|
||||
|
||||
this.getCerts(res.organization);
|
||||
this.getCerts(application.organization);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ChatEditPage extends React.Component {
|
||||
chat: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.organization);
|
||||
this.getUsers(res.data.organization);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class MessageEditPage extends React.Component {
|
||||
this.setState({
|
||||
message: res.data,
|
||||
});
|
||||
this.getUsers(res.organization);
|
||||
this.getUsers(res.data.organization);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,12 @@ class PaymentResultPage extends React.Component {
|
||||
|
||||
getPayment() {
|
||||
PaymentBackend.getPayment("admin", this.state.paymentName)
|
||||
.then((payment) => {
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
payment: payment,
|
||||
payment: res.data,
|
||||
});
|
||||
|
||||
if (payment.state === "Created") {
|
||||
if (res.data.state === "Created") {
|
||||
this.setState({timeout: setTimeout(() => this.getPayment(), 1000)});
|
||||
}
|
||||
});
|
||||
|
@ -46,18 +46,18 @@ class PlanEditPage extends React.Component {
|
||||
|
||||
getPlan() {
|
||||
PlanBackend.getPlan(this.state.organizationName, this.state.planName)
|
||||
.then((plan) => {
|
||||
if (plan === null) {
|
||||
.then((res) => {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
plan: plan,
|
||||
plan: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(plan.owner);
|
||||
this.getRoles(plan.owner);
|
||||
this.getUsers(this.state.organizationName);
|
||||
this.getRoles(this.state.organizationName);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class PricingEditPage extends React.Component {
|
||||
this.setState({
|
||||
pricing: res.data,
|
||||
});
|
||||
this.getPlans(res.owner);
|
||||
this.getPlans(this.state.organizationName);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,14 +46,14 @@ class ProductEditPage extends React.Component {
|
||||
|
||||
getProduct() {
|
||||
ProductBackend.getProduct(this.state.organizationName, this.state.productName)
|
||||
.then((product) => {
|
||||
if (product === null) {
|
||||
.then((res) => {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
product: product,
|
||||
product: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class RoleEditPage extends React.Component {
|
||||
role: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.owner);
|
||||
this.getRoles(res.owner);
|
||||
this.getUsers(this.state.organizationName);
|
||||
this.getRoles(this.state.organizationName);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ class SubscriptionEditPage extends React.Component {
|
||||
subscription: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.owner);
|
||||
this.getPlanes(res.owner);
|
||||
this.getUsers(this.state.organizationName);
|
||||
this.getPlanes(this.state.organizationName);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user