From 6afdeb74083d0e8c1e821e34e6b96a97ba113863 Mon Sep 17 00:00:00 2001 From: Robert Barrow Date: Fri, 31 May 2019 22:32:24 +0100 Subject: [PATCH] resolved type error for api.get not a function and for error on save when no endpoints --- .../controllers/admin-wizards-api.js.es6 | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 index 642eb9e7..e230ce37 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 @@ -32,7 +32,7 @@ export default Ember.Controller.extend({ let query = '?'; 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) { authParams.forEach(p => { @@ -47,33 +47,36 @@ export default Ember.Controller.extend({ }, save() { + debugger; const api = this.get('api'); - const service = api.get('service'); + const service = api.service; let data = {}; - data['auth_type'] = api.get('authType'); - data['auth_url'] = api.get('authUrl'); + data['auth_type'] = api.authType; + data['auth_url'] = api.authUrl; if (data.auth_type === 'oauth') { - data['client_id'] = api.get('clientId'); - data['client_secret'] = api.get('clientSecret'); + data['client_id'] = api.clientId; + data['client_secret'] = api.clientSecret; - let params = api.get('authParams'); + let params = api.authParams; if (params) { data['auth_params'] = JSON.stringify(params); } - data['token_url'] = api.get('tokenUrl'); + data['token_url'] = api.tokenUrl; } else { - data['username'] = api.get('username'); - data['password'] = api.get('password'); + data['username'] = api.username; + data['password'] = api.password; } - const endpoints = api.get('endpoints'); - if (endpoints.length) { - data['endpoints'] = JSON.stringify(endpoints); + const endpoints = api.endpoints; + if (endpoints != undefined) { + if (endpoints.length) { + data['endpoints'] = JSON.stringify(endpoints); + } } this.set('savingApi', true);