initialize auth params and endpoints in the route & model
Dieser Commit ist enthalten in:
Ursprung
65979e1987
Commit
6345083c4d
3 geänderte Dateien mit 3 neuen und 9 gelöschten Zeilen
|
@ -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({});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Laden …
In neuem Issue referenzieren