diff options
Diffstat (limited to 'webapp/client/client.jsx')
-rw-r--r-- | webapp/client/client.jsx | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index 3ce6977f6..a7d7a5c8a 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -201,12 +201,12 @@ export default class Client { if (errorCallback) { errorCallback(e, err, res); - return; } + return; } if (successCallback) { - if (res.body) { + if (res && res.body) { successCallback(res.body, res); } else { console.error('Missing response body for ' + methodName); // eslint-disable-line no-console @@ -921,6 +921,15 @@ export default class Client { end(this.handleResponse.bind(this, 'getUser', success, error)); } + getByUsername(userName, success, error) { + request. + get(`${this.getUsersRoute()}/name/${userName}`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + end(this.handleResponse.bind(this, 'getByUsername', success, error)); + } + login(loginId, password, mfaToken, success, error) { this.doLogin({login_id: loginId, password, token: mfaToken}, success, error); @@ -1457,6 +1466,18 @@ export default class Client { this.track('api', 'api_integrations_created'); } + editCommand(command, success, error) { + request. + post(`${this.getCommandsRoute()}/update`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + send(command). + end(this.handleResponse.bind(this, 'editCommand', success, error)); + + this.track('api', 'api_integrations_created'); + } + deleteCommand(commandId, success, error) { request. post(`${this.getCommandsRoute()}/delete`). @@ -1496,7 +1517,7 @@ export default class Client { set(this.defaultHeaders). type('application/json'). accept('application/json'). - send(post). + send({...post, create_at: 0}). end(this.handleResponse.bind(this, 'createPost', success, error)); this.track('api', 'api_posts_create', post.channel_id, 'length', post.message.length); |