Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
evolve service
Dieser Commit ist enthalten in:
Ursprung
a558e19a54
Commit
b1fddc33a7
2 geänderte Dateien mit 35 neuen und 7 gelöschten Zeilen
|
@ -7,6 +7,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
|||
|
||||
export default class WizardSubscriptionStatus extends Component {
|
||||
@service siteSettings;
|
||||
@service subscription;
|
||||
@tracked supplierId = null;
|
||||
@tracked authorized = false;
|
||||
@tracked unauthorizing = false;
|
||||
|
@ -17,6 +18,9 @@ export default class WizardSubscriptionStatus extends Component {
|
|||
ajax(`${this.basePath}`).then((result) => {
|
||||
this.supplierId = result.suppliers[0].id;
|
||||
this.authorized = result.suppliers[0].authorized;
|
||||
})
|
||||
.finally(() => {
|
||||
this.subscription.retrieveSubscriptionStatus();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +45,8 @@ export default class WizardSubscriptionStatus extends Component {
|
|||
})
|
||||
.finally(() => {
|
||||
this.unauthorizing = false;
|
||||
window.location.reload();
|
||||
this.subscription.retrieveSubscriptionStatus();
|
||||
//window.location.reload();
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import Service from '@ember/service';
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { equal } from "@ember/object/computed";
|
||||
|
||||
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
||||
const SUPPORT_MESSAGE =
|
||||
|
@ -8,13 +12,32 @@ const MANAGER_CATEGORY =
|
|||
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
|
||||
|
||||
export default class SubscriptionService extends Service {
|
||||
@tracked subscribed = false;
|
||||
@tracked subscriptionType = "";
|
||||
@tracked businessSubscription = false;
|
||||
@tracked communitySubscription = false;
|
||||
@tracked standardSubscription = false;
|
||||
@tracked subscriptionAttributes = {};
|
||||
subscriptionLandingUrl = PRODUCT_PAGE;
|
||||
subscribed = this.adminWizards.subscribed;
|
||||
subscriptionType = this.adminWizards.subscriptionType;
|
||||
businessSubscription = this.adminWizards.businessSubscription;
|
||||
communitySubscription = this.adminWizards.communitySubscription;
|
||||
standardSubscription = this.adminWizards.standardSubscription;
|
||||
subscriptionAttributes = this.adminWizards.subscriptionAttributes;
|
||||
|
||||
init() {
|
||||
super.init(...arguments);
|
||||
debugger;
|
||||
this.retrieveSubscriptionStatus();
|
||||
}
|
||||
|
||||
retrieveSubscriptionStatus() {
|
||||
ajax("/admin/wizards").then(result => {
|
||||
this.subscribed = result.subscribed;
|
||||
this.subscriptionType = result.subscription_type;
|
||||
this.subscriptionAttributes = result.subscription_attributes;
|
||||
this.businessSubscription = equal(this.subscriptionType, "business");
|
||||
this.communitySubscription = equal(this.subscriptionType, "community");
|
||||
this.standardSubscription = equal(this.subscriptionType, "standard");
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
};
|
||||
|
||||
|
||||
get adminWizards() {
|
||||
return getOwner(this).lookup("controller:admin-wizards");
|
||||
|
|
Laden …
In neuem Issue referenzieren