discourse/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
907 B
JavaScript
Raw Normal View History

import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
2016-06-16 01:49:57 +08:00
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
2016-06-16 01:49:57 +08:00
export default class AdminWebHooksShowController extends Controller {
@service dialog;
@service router;
@controller adminWebHooks;
2016-06-16 01:49:57 +08:00
@action
edit() {
return this.router.transitionTo("adminWebHooks.edit", this.model);
}
@action
destroyWebhook() {
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.router.transitionTo("adminWebHooks");
} catch (e) {
popupAjaxError(e);
}
},
});
}
}