Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 01:10:28 +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 {
|
export default class WizardSubscriptionStatus extends Component {
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
|
@service subscription;
|
||||||
@tracked supplierId = null;
|
@tracked supplierId = null;
|
||||||
@tracked authorized = false;
|
@tracked authorized = false;
|
||||||
@tracked unauthorizing = false;
|
@tracked unauthorizing = false;
|
||||||
|
@ -17,6 +18,9 @@ export default class WizardSubscriptionStatus extends Component {
|
||||||
ajax(`${this.basePath}`).then((result) => {
|
ajax(`${this.basePath}`).then((result) => {
|
||||||
this.supplierId = result.suppliers[0].id;
|
this.supplierId = result.suppliers[0].id;
|
||||||
this.authorized = result.suppliers[0].authorized;
|
this.authorized = result.suppliers[0].authorized;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.subscription.retrieveSubscriptionStatus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +45,8 @@ export default class WizardSubscriptionStatus extends Component {
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.unauthorizing = false;
|
this.unauthorizing = false;
|
||||||
window.location.reload();
|
this.subscription.retrieveSubscriptionStatus();
|
||||||
|
//window.location.reload();
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
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 PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
||||||
const SUPPORT_MESSAGE =
|
const SUPPORT_MESSAGE =
|
||||||
|
@ -8,13 +12,32 @@ const MANAGER_CATEGORY =
|
||||||
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
|
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
|
||||||
|
|
||||||
export default class SubscriptionService extends Service {
|
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;
|
subscriptionLandingUrl = PRODUCT_PAGE;
|
||||||
subscribed = this.adminWizards.subscribed;
|
|
||||||
subscriptionType = this.adminWizards.subscriptionType;
|
init() {
|
||||||
businessSubscription = this.adminWizards.businessSubscription;
|
super.init(...arguments);
|
||||||
communitySubscription = this.adminWizards.communitySubscription;
|
debugger;
|
||||||
standardSubscription = this.adminWizards.standardSubscription;
|
this.retrieveSubscriptionStatus();
|
||||||
subscriptionAttributes = this.adminWizards.subscriptionAttributes;
|
}
|
||||||
|
|
||||||
|
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() {
|
get adminWizards() {
|
||||||
return getOwner(this).lookup("controller:admin-wizards");
|
return getOwner(this).lookup("controller:admin-wizards");
|
||||||
|
|
Laden …
In neuem Issue referenzieren