0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 10:40:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/models/custom-wizard-custom-field.js.es6
Angus McLeod cf50a7deb3
Apply prettier 💄 (#80)
* Apply prettier

* applied prettier for similar-topics-validator

Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
2021-03-28 14:36:49 +05:30

33 Zeilen
767 B
JavaScript

import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import EmberObject from "@ember/object";
import { isEmpty } from "@ember/utils";
const CustomWizardCustomField = EmberObject.extend({
isNew: isEmpty("id"),
});
const basePath = "/admin/wizards/custom-fields";
CustomWizardCustomField.reopenClass({
listFields() {
return ajax(basePath).catch(popupAjaxError);
},
saveField(customField) {
return ajax(basePath, {
type: "PUT",
data: {
custom_field: customField,
},
}).catch(popupAjaxError);
},
destroyField(field) {
return ajax(`${basePath}/${field.name}`, {
type: "DELETE",
}).catch(popupAjaxError);
},
});
export default CustomWizardCustomField;