0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-13 21:42:53 +01:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizards-api-show.js.es6

26 Zeilen
611 B
Text

import CustomWizardApi from "../models/custom-wizard-api";
2020-04-13 14:17:22 +02:00
import DiscourseRoute from "discourse/routes/discourse";
2023-09-14 15:47:52 +02:00
import { inject as service } from "@ember/service";
2020-04-13 14:17:22 +02:00
export default DiscourseRoute.extend({
2023-09-14 15:42:12 +02:00
router: service(),
2020-04-13 14:17:22 +02:00
model(params) {
if (params.name === "create") {
2020-04-13 14:17:22 +02:00
return CustomWizardApi.create({ isNew: true });
} else {
return CustomWizardApi.find(params.name);
}
},
afterModel(model) {
if (model === null) {
2023-09-14 15:42:12 +02:00
return this.router.transitionTo("adminWizardsApi");
}
},
setupController(controller, model) {
2020-04-13 14:17:22 +02:00
controller.set("api", model);
},
2020-04-13 14:17:22 +02:00
});