Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
33 Zeilen
719 B
JavaScript
33 Zeilen
719 B
JavaScript
import { ajax } from "discourse/lib/ajax";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
import EmberObject from "@ember/object";
|
|
|
|
const CustomWizardSubscription = EmberObject.extend();
|
|
|
|
const basePath = "/admin/wizards/subscription";
|
|
|
|
CustomWizardSubscription.reopenClass({
|
|
status() {
|
|
return ajax(basePath, {
|
|
type: "GET",
|
|
}).catch(popupAjaxError);
|
|
},
|
|
|
|
authorize() {
|
|
window.location.href = `${basePath}/authorize`;
|
|
},
|
|
|
|
unauthorize() {
|
|
return ajax(`${basePath}/authorize`, {
|
|
type: "DELETE",
|
|
}).catch(popupAjaxError);
|
|
},
|
|
|
|
update() {
|
|
return ajax(basePath, {
|
|
type: "POST",
|
|
}).catch(popupAjaxError);
|
|
},
|
|
});
|
|
|
|
export default CustomWizardSubscription;
|