mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 07:51:36 +08:00
a2ea9c5417
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.transitionToRoute` calls on controllers to directly call the router service (`this.router.transitionTo`)
33 lines
890 B
JavaScript
33 lines
890 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.router.transitionTo("adminWebHooks");
|
|
} catch (e) {
|
|
popupAjaxError(e);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
}
|