discourse/app/assets/javascripts/admin/addon/routes/admin-web-hooks-edit.js

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

29 lines
660 B
JavaScript
Raw Normal View History

import DiscourseRoute from "discourse/routes/discourse";
export default class AdminWebHooksEditRoute extends DiscourseRoute {
serialize(model) {
return { web_hook_id: model.id || "new" };
}
model(params) {
if (params.web_hook_id === "new") {
return this.store.createRecord("web-hook");
}
return this.store.find("web-hook", params.web_hook_id);
}
setupController(controller, model) {
super.setupController(...arguments);
if (model.get("isNew")) {
model.set(
"web_hook_event_types",
this.controllerFor("adminWebHooks").defaultEventTypes
);
}
controller.set("saved", false);
}
}