0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 17:30:29 +01:00

initialize auth params and endpoints in the route & model

Dieser Commit ist enthalten in:
Angus McLeod 2019-06-01 12:25:09 +10:00
Ursprung 65979e1987
Commit 6345083c4d
3 geänderte Dateien mit 3 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -11,9 +11,6 @@ export default Ember.Controller.extend({
actions: { actions: {
addParam() { addParam() {
if (this.get('api.authParams') == undefined) {
this.set('api.authParams',[]);
};
this.get('api.authParams').pushObject({}); this.get('api.authParams').pushObject({});
}, },
@ -22,9 +19,6 @@ export default Ember.Controller.extend({
}, },
addEndpoint() { addEndpoint() {
if (this.get('api.endpoints') == undefined) {
this.set('api.endpoints',[]);
};
this.get('api.endpoints').pushObject({}); this.get('api.endpoints').pushObject({});
}, },

Datei anzeigen

@ -10,9 +10,9 @@ const CustomWizardApi = Discourse.Model.extend({
}); });
CustomWizardApi.reopenClass({ CustomWizardApi.reopenClass({
create(params) { create(params = {}) {
const api = this._super.apply(this); const api = this._super.apply(this);
const authorization = params.authorization; const authorization = params.authorization || {};
const endpoints = params.endpoints; const endpoints = params.endpoints;
api.setProperties({ api.setProperties({

Datei anzeigen

@ -3,7 +3,7 @@ import CustomWizardApi from '../models/custom-wizard-api';
export default Discourse.Route.extend({ export default Discourse.Route.extend({
model(params) { model(params) {
if (params.service === 'new') { if (params.service === 'new') {
return {}; return CustomWizardApi.create();
} else { } else {
return CustomWizardApi.find(params.service); return CustomWizardApi.find(params.service);
} }