diff options
Diffstat (limited to 'webapp/client')
-rw-r--r-- | webapp/client/client.jsx | 27 | ||||
-rw-r--r-- | webapp/client/web_client.jsx | 10 | ||||
-rw-r--r-- | webapp/client/webrtc_session.jsx | 6 |
3 files changed, 32 insertions, 11 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); diff --git a/webapp/client/web_client.jsx b/webapp/client/web_client.jsx index 5d2696c37..85ced325e 100644 --- a/webapp/client/web_client.jsx +++ b/webapp/client/web_client.jsx @@ -14,26 +14,26 @@ class WebClientClass extends Client { constructor() { super(); this.enableLogErrorsToConsole(true); - TeamStore.addChangeListener(this.onTeamStoreChanged); + TeamStore.addChangeListener(this.onTeamStoreChanged.bind(this)); } - onTeamStoreChanged = () => { + onTeamStoreChanged() { this.setTeamId(TeamStore.getCurrentId()); } - track = (category, action, label, property, value) => { + track(category, action, label, property, value) { if (global.window && global.window.analytics) { global.window.analytics.track(action, {category, label, property, value}); } } - trackPage = () => { + trackPage() { if (global.window && global.window.analytics) { global.window.analytics.page(); } } - handleError = (err, res) => { // eslint-disable-line no-unused-vars + handleError(err, res) { if (err.status === HTTP_UNAUTHORIZED && res.req.url !== '/api/v3/users/login') { GlobalActions.emitUserLoggedOutEvent('/login'); } diff --git a/webapp/client/webrtc_session.jsx b/webapp/client/webrtc_session.jsx index 9ee7fcd5a..df60a1053 100644 --- a/webapp/client/webrtc_session.jsx +++ b/webapp/client/webrtc_session.jsx @@ -1951,7 +1951,7 @@ export default class WebrtcSession { return (trickle === true); } - unbindWebSocket = (onUnbindMessage, onUnbindError) => { + unbindWebSocket(onUnbindMessage, onUnbindError) { for (var eventName in this.wsHandlers) { if (this.wsHandlers.hasOwnProperty(eventName)) { this.ws.removeEventListener(eventName, this.wsHandlers[eventName]); @@ -1962,5 +1962,5 @@ export default class WebrtcSession { if (this.wsKeepaliveTimeoutId) { clearTimeout(this.wsKeepaliveTimeoutId); } - }; -}
\ No newline at end of file + } +} |