2021-08-10 08:45:23 +02:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
import EmberObject from "@ember/object";
|
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
const CustomWizardSubscription = EmberObject.extend();
|
2021-08-10 08:45:23 +02:00
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
const basePath = "/admin/wizards/subscription";
|
2021-08-10 08:45:23 +02:00
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
CustomWizardSubscription.reopenClass({
|
2021-08-10 08:45:23 +02:00
|
|
|
status() {
|
|
|
|
return ajax(basePath, {
|
|
|
|
type: "GET",
|
|
|
|
}).catch(popupAjaxError);
|
|
|
|
},
|
|
|
|
|
|
|
|
authorize() {
|
|
|
|
window.location.href = `${basePath}/authorize`;
|
|
|
|
},
|
|
|
|
|
|
|
|
unauthorize() {
|
|
|
|
return ajax(`${basePath}/authorize`, {
|
|
|
|
type: "DELETE",
|
|
|
|
}).catch(popupAjaxError);
|
|
|
|
},
|
2021-09-07 14:13:01 +02:00
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
update() {
|
|
|
|
return ajax(basePath, {
|
2021-08-10 08:45:23 +02:00
|
|
|
type: "POST",
|
|
|
|
}).catch(popupAjaxError);
|
2021-09-07 14:13:01 +02:00
|
|
|
},
|
2021-08-10 08:45:23 +02:00
|
|
|
});
|
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
export default CustomWizardSubscription;
|