diff options
author | George Goldberg <george@gberg.me> | 2017-03-17 16:29:26 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-03-17 16:29:26 +0000 |
commit | 7f266c19511171f509ae8a60170de10c8d10b41e (patch) | |
tree | 04cd68ac4722313abec3ea47cc7cda229e463b1d /webapp/utils/async_client.jsx | |
parent | bfae88e60c7a623afae82e06ce1421ca778c06e7 (diff) | |
parent | 8568afe5b4fb4d26b14fbc0d21f088eaa490b314 (diff) | |
download | chat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.gz chat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.bz2 chat-7f266c19511171f509ae8a60170de10c8d10b41e.zip |
Merge branch 'release-3.7' into master.
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r-- | webapp/utils/async_client.jsx | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 2ecb0f07d..1fc19b5f2 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -64,26 +64,31 @@ export function checkVersion() { } export function getChannels() { - if (isCallInProgress('getChannels')) { - return null; - } + return new Promise((resolve, reject) => { + if (isCallInProgress('getChannels')) { + resolve(); + return; + } - callTracker.getChannels = utils.getTimestamp(); + callTracker.getChannels = utils.getTimestamp(); - return Client.getChannels( - (data) => { - callTracker.getChannels = 0; + Client.getChannels( + (data) => { + callTracker.getChannels = 0; - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_CHANNELS, - channels: data - }); - }, - (err) => { - callTracker.getChannels = 0; - dispatchError(err, 'getChannels'); - } - ); + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_CHANNELS, + channels: data + }); + resolve(); + }, + (err) => { + callTracker.getChannels = 0; + dispatchError(err, 'getChannels'); + reject(); + } + ); + }); } export function getChannel(id) { @@ -130,7 +135,7 @@ export function getMyChannelMembers() { resolve(); }, (err) => { - callTracker.getChannelsUnread = 0; + callTracker.getMyChannelMembers = 0; dispatchError(err, 'getMyChannelMembers'); reject(new Error('Unable to getMyChannelMembers')); } |