1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/routes/admin-wizards-apis.js.es6

33 Zeilen
682 B
Text

import CustomWizardApi from '../models/custom-wizard-api';
2020-03-21 18:30:11 +01:00
import DiscourseRoute from "discourse/routes/discourse";
2020-03-21 18:30:11 +01:00
export default DiscourseRoute.extend({
model() {
return CustomWizardApi.list();
},
afterModel(model) {
const apiParams = this.paramsFor('admin-wizards-api');
if (model.length) {
if (!apiParams.name) {
this.transitionTo('adminWizardsApi', model[0].name.dasherize());
} else {
return;
}
} else {
this.transitionTo('adminWizardsApi', 'new');
}
},
setupController(controller, model){
controller.set("model", model);
},
actions: {
refreshModel() {
this.refresh();
}
}
});