discourse/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show.js
David Taylor be354e7950
DEV: Update admin controllers to native class syntax (#20674)
This commit was generated using the ember-native-class-codemod along with a handful of manual updates
2023-03-15 09:42:12 +00:00

33 lines
888 B
JavaScript

import { inject as service } from "@ember/service";
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import I18n from "I18n";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default class AdminWebHooksShowController extends Controller {
@service dialog;
@service router;
@controller adminWebHooks;
@action
edit() {
return this.router.transitionTo("adminWebHooks.edit", this.model);
}
@action
destroy() {
return this.dialog.deleteConfirm({
message: I18n.t("admin.web_hooks.delete_confirm"),
didConfirm: async () => {
try {
await this.model.destroyRecord();
this.adminWebHooks.model.removeObject(this.model);
this.transitionToRoute("adminWebHooks");
} catch (e) {
popupAjaxError(e);
}
},
});
}
}