diff --git a/controllers/plan.go b/controllers/plan.go index a8e8f387..a9f71a6e 100644 --- a/controllers/plan.go +++ b/controllers/plan.go @@ -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 diff --git a/controllers/product.go b/controllers/product.go index 488f1f7a..ec12cb54 100644 --- a/controllers/product.go +++ b/controllers/product.go @@ -88,8 +88,7 @@ func (c *ApiController) GetProduct() { return } - c.Data["json"] = product - c.ServeJSON() + c.ResponseOk(product) } // UpdateProduct diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index cf1664f7..13df7643 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -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); }); } diff --git a/web/src/ChatEditPage.js b/web/src/ChatEditPage.js index e3db4886..4d9bbd21 100644 --- a/web/src/ChatEditPage.js +++ b/web/src/ChatEditPage.js @@ -54,7 +54,7 @@ class ChatEditPage extends React.Component { chat: res.data, }); - this.getUsers(res.organization); + this.getUsers(res.data.organization); }); } diff --git a/web/src/MessageEditPage.js b/web/src/MessageEditPage.js index 73c5c6ee..7a4d90ed 100644 --- a/web/src/MessageEditPage.js +++ b/web/src/MessageEditPage.js @@ -58,7 +58,7 @@ class MessageEditPage extends React.Component { this.setState({ message: res.data, }); - this.getUsers(res.organization); + this.getUsers(res.data.organization); }); } diff --git a/web/src/PaymentResultPage.js b/web/src/PaymentResultPage.js index da82ef55..14a7c7c1 100644 --- a/web/src/PaymentResultPage.js +++ b/web/src/PaymentResultPage.js @@ -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)}); } }); diff --git a/web/src/PlanEditPage.js b/web/src/PlanEditPage.js index 49bfafdc..b2c2374f 100644 --- a/web/src/PlanEditPage.js +++ b/web/src/PlanEditPage.js @@ -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); }); } diff --git a/web/src/PricingEditPage.js b/web/src/PricingEditPage.js index ab70aace..b28378f8 100644 --- a/web/src/PricingEditPage.js +++ b/web/src/PricingEditPage.js @@ -62,7 +62,7 @@ class PricingEditPage extends React.Component { this.setState({ pricing: res.data, }); - this.getPlans(res.owner); + this.getPlans(this.state.organizationName); }); } diff --git a/web/src/ProductEditPage.js b/web/src/ProductEditPage.js index dbf69709..c2e29f63 100644 --- a/web/src/ProductEditPage.js +++ b/web/src/ProductEditPage.js @@ -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, }); }); } diff --git a/web/src/RoleEditPage.js b/web/src/RoleEditPage.js index 1ff66789..4afabf2f 100644 --- a/web/src/RoleEditPage.js +++ b/web/src/RoleEditPage.js @@ -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); }); } diff --git a/web/src/SubscriptionEditPage.js b/web/src/SubscriptionEditPage.js index 0eb0f129..9f307c5e 100644 --- a/web/src/SubscriptionEditPage.js +++ b/web/src/SubscriptionEditPage.js @@ -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); }); }