diff --git a/assets/javascripts/discourse/components/wizard-subscription-badge.hbs b/assets/javascripts/discourse/components/wizard-subscription-badge.hbs index fb5becfa..6ef0c754 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-badge.hbs +++ b/assets/javascripts/discourse/components/wizard-subscription-badge.hbs @@ -2,6 +2,7 @@ @action={{this.click}} class="wizard-subscription-badge {{this.subscription.subscriptionType}}" @title={{this.title}} + {{did-insert this.update}} > { - // if (this.subscription.subscribed) { - // this.updateIcon = "check"; - // } else { - // this.updateIcon = "times"; - // } - // }) - // .catch(popupAjaxError) - // .finally(() => { - // this.updating = false; - // setTimeout(() => { - // this.updateIcon = null; - // }, 7000); - // }); + this.updating = true; + this.updateIcon = "check"; + this.subscription.retrieveSubscriptionStatus().finally(() => { + this.updating = false; + setTimeout(() => { + this.updateIcon = null; + }, 5000); + }) } -} +} \ No newline at end of file diff --git a/assets/javascripts/discourse/services/subscription.js b/assets/javascripts/discourse/services/subscription.js index b939210e..42f2afca 100644 --- a/assets/javascripts/discourse/services/subscription.js +++ b/assets/javascripts/discourse/services/subscription.js @@ -23,19 +23,15 @@ export default class SubscriptionService extends Service { this.retrieveSubscriptionStatus(); } - retrieveSubscriptionStatus() { - debugger; - ajax("/admin/wizards/subscription") - .then((result) => { - debugger; - this.subscribed = result.subscribed; - this.subscriptionType = result.subscription_type; - this.subscriptionAttributes = result.subscription_attributes; - this.businessSubscription = this.subscriptionType === "business"; - this.communitySubscription = this.subscriptionType === "community"; - this.standardSubscription = this.subscriptionType === "standard"; - }) - .catch(popupAjaxError); + async retrieveSubscriptionStatus() { + let result = await ajax("/admin/wizards/subscription").catch(popupAjaxError); + + this.subscribed = result.subscribed; + this.subscriptionType = result.subscription_type; + this.subscriptionAttributes = result.subscription_attributes; + this.businessSubscription = this.subscriptionType === "business"; + this.communitySubscription = this.subscriptionType === "community"; + this.standardSubscription = this.subscriptionType === "standard"; } get subscriptionLink() {