From 07bed7ec860348e50d2021820de53f472d2ded9b Mon Sep 17 00:00:00 2001 From: merefield Date: Fri, 22 Sep 2023 11:02:44 +0100 Subject: [PATCH 1/2] evolve --- .../components/wizard-subscription-authorize.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-subscription-authorize.js b/assets/javascripts/discourse/components/wizard-subscription-authorize.js index 577739d5..1e8e3c28 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-authorize.js +++ b/assets/javascripts/discourse/components/wizard-subscription-authorize.js @@ -16,7 +16,7 @@ export default class WizardSubscriptionAuthorize extends Component { constructor() { super(...arguments); - ajax("/admin/plugins/subscription-client/suppliers?final_landing_path%3D%2Fadmin%2Fwizards%2Fwizard").then((result) => { + ajax("/admin/plugins/subscription-client/suppliers").then((result) => { this.supplierId = result.suppliers[0].id; this.authorized = result.suppliers[0].authorized; }) @@ -24,7 +24,8 @@ export default class WizardSubscriptionAuthorize extends Component { @action authorize() { - window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}`; + window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}&final_landing_path=/admin/wizards/wizard`; + //window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}&final_landing_path%3D%2Fadmin%2Fwizards%2Fwizard`; } @action @@ -39,8 +40,8 @@ export default class WizardSubscriptionAuthorize extends Component { }) .then((result) => { console.log(result); - this.supplierId = result.suppliers[0].id; - this.authorized = result.suppliers[0].authorized; + this.supplierId = result.supplier.id; + this.authorized = !(result.supplier.authorized_at === null); }) .finally(() => { this.unauthorizing = false; From 28f17045c56bd54b06e45059e48c2b274cbd4c63 Mon Sep 17 00:00:00 2001 From: merefield Date: Fri, 22 Sep 2023 11:22:27 +0100 Subject: [PATCH 2/2] debug --- .../discourse/components/wizard-subscription-authorize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/wizard-subscription-authorize.js b/assets/javascripts/discourse/components/wizard-subscription-authorize.js index 1e8e3c28..fcaa63ab 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-authorize.js +++ b/assets/javascripts/discourse/components/wizard-subscription-authorize.js @@ -17,6 +17,7 @@ export default class WizardSubscriptionAuthorize extends Component { constructor() { super(...arguments); ajax("/admin/plugins/subscription-client/suppliers").then((result) => { + console.log(result) this.supplierId = result.suppliers[0].id; this.authorized = result.suppliers[0].authorized; }) @@ -25,7 +26,6 @@ export default class WizardSubscriptionAuthorize extends Component { @action authorize() { window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}&final_landing_path=/admin/wizards/wizard`; - //window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}&final_landing_path%3D%2Fadmin%2Fwizards%2Fwizard`; } @action