discourse/app/assets/javascripts/admin/addon/controllers/admin-web-hooks.js
2020-12-01 15:31:26 -03:00

31 lines
699 B
JavaScript

import Controller from "@ember/controller";
import I18n from "I18n";
import bootbox from "bootbox";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Controller.extend({
actions: {
destroy(webhook) {
return bootbox.confirm(
I18n.t("admin.web_hooks.delete_confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
(result) => {
if (result) {
webhook
.destroyRecord()
.then(() => {
this.model.removeObject(webhook);
})
.catch(popupAjaxError);
}
}
);
},
loadMore() {
this.model.loadMore();
},
},
});