1
0
Fork 0

resolved type error for api.get not a function and for error on save when no endpoints

Dieser Commit ist enthalten in:
Robert Barrow 2019-05-31 22:32:24 +01:00
Ursprung 9ff904d0fa
Commit 6afdeb7408

Datei anzeigen

@ -32,7 +32,7 @@ export default Ember.Controller.extend({
let query = '?'; let query = '?';
if (authType === 'oauth') { if (authType === 'oauth') {
query += `client_id=${api.get('clientId')}&redirect_uri=${encodeURIComponent(api.get('redirectUri'))}&response_type=code`; query += `client_id=${api.clientId}&redirect_uri=${encodeURIComponent(api.redirectUri)}&response_type=code`;
if (authParams) { if (authParams) {
authParams.forEach(p => { authParams.forEach(p => {
@ -47,33 +47,36 @@ export default Ember.Controller.extend({
}, },
save() { save() {
debugger;
const api = this.get('api'); const api = this.get('api');
const service = api.get('service'); const service = api.service;
let data = {}; let data = {};
data['auth_type'] = api.get('authType'); data['auth_type'] = api.authType;
data['auth_url'] = api.get('authUrl'); data['auth_url'] = api.authUrl;
if (data.auth_type === 'oauth') { if (data.auth_type === 'oauth') {
data['client_id'] = api.get('clientId'); data['client_id'] = api.clientId;
data['client_secret'] = api.get('clientSecret'); data['client_secret'] = api.clientSecret;
let params = api.get('authParams'); let params = api.authParams;
if (params) { if (params) {
data['auth_params'] = JSON.stringify(params); data['auth_params'] = JSON.stringify(params);
} }
data['token_url'] = api.get('tokenUrl'); data['token_url'] = api.tokenUrl;
} else { } else {
data['username'] = api.get('username'); data['username'] = api.username;
data['password'] = api.get('password'); data['password'] = api.password;
} }
const endpoints = api.get('endpoints'); const endpoints = api.endpoints;
if (endpoints.length) { if (endpoints != undefined) {
data['endpoints'] = JSON.stringify(endpoints); if (endpoints.length) {
data['endpoints'] = JSON.stringify(endpoints);
}
} }
this.set('savingApi', true); this.set('savingApi', true);