feat: fix response data assignment error (#2123)

This commit is contained in:
Yaodong Yu 2023-07-24 14:52:30 +08:00 committed by GitHub
parent 3c4112dd44
commit 577bd6ce58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 28 additions and 29 deletions

View File

@ -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

View File

@ -88,8 +88,7 @@ func (c *ApiController) GetProduct() {
return
}
c.Data["json"] = product
c.ServeJSON()
c.ResponseOk(product)
}
// UpdateProduct

View File

@ -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);
});
}

View File

@ -54,7 +54,7 @@ class ChatEditPage extends React.Component {
chat: res.data,
});
this.getUsers(res.organization);
this.getUsers(res.data.organization);
});
}

View File

@ -58,7 +58,7 @@ class MessageEditPage extends React.Component {
this.setState({
message: res.data,
});
this.getUsers(res.organization);
this.getUsers(res.data.organization);
});
}

View File

@ -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)});
}
});

View File

@ -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);
});
}

View File

@ -62,7 +62,7 @@ class PricingEditPage extends React.Component {
this.setState({
pricing: res.data,
});
this.getPlans(res.owner);
this.getPlans(this.state.organizationName);
});
}

View File

@ -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,
});
});
}

View File

@ -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);
});
}

View File

@ -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);
});
}