summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx41
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'));
}