1
0
Fork 0

point to new sub client gem update, add deauthorize action

Dieser Commit ist enthalten in:
merefield 2023-09-22 08:17:52 +01:00
Ursprung 3a0ba4589d
Commit f1e3db48a3
2 geänderte Dateien mit 28 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -1,22 +1,22 @@
// import { geoLocationSearch, providerDetails } from "../lib/location-utilities";
//import { ajax } from "discourse/lib/ajax";
import { action, set } from "@ember/object"; import { action, set } from "@ember/object";
// import { equal } from "@ember/object/computed";
// import { A } from "@ember/array";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
// import I18n from "I18n"; import { popupAjaxError } from "discourse/lib/ajax-error";
export default class WizardSubscriptionAuthorize extends Component { export default class WizardSubscriptionAuthorize extends Component {
basePath = "/admin/plugins/subscription-client/suppliers";
@service siteSettings; @service siteSettings;
@tracked supplierId = null; @tracked supplierId = null;
@tracked authorized = false; @tracked authorized = false;
@tracked unauthorizing = false;
constructor() { constructor() {
super(...arguments); super(...arguments);
ajax("/admin/plugins/subscription-client/suppliers").then((result) => { ajax("/admin/plugins/subscription-client/suppliers?final_landing_path%3D%2Fadmin%2Fwizards%2Fwizard").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;
}) })
@ -24,6 +24,26 @@ export default class WizardSubscriptionAuthorize extends Component {
@action @action
authorize() { authorize() {
window.location.href = `/admin/plugins/subscription-client/suppliers/authorize?supplier_id=${this.supplierId}`; window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}`;
} }
@action
deauthorize() {
this.unauthorizing = true;
ajax(`${this.basePath}/authorize`, {
type: "DELETE",
data: {
supplier_id: this.supplierId,
},
})
.then((result) => {
this.supplierId = result.suppliers[0].id;
this.authorized = result.suppliers[0].authorized;
})
.finally(() => {
this.unauthorizing = false;
})
.catch(popupAjaxError);
};
} }

Datei anzeigen

@ -8,7 +8,7 @@
# subscription_url: https://coop.pavilion.tech # subscription_url: https://coop.pavilion.tech
gem 'liquid', '5.0.1', require: true gem 'liquid', '5.0.1', require: true
gem "discourse_subscription_client", "0.1.0.pre14", require_name: "discourse_subscription_client" gem "discourse_subscription_client", "0.1.0.pre15", require_name: "discourse_subscription_client"
register_asset 'stylesheets/common/admin.scss' register_asset 'stylesheets/common/admin.scss'
register_asset 'stylesheets/common/wizard.scss' register_asset 'stylesheets/common/wizard.scss'