diff options
Diffstat (limited to 'web/react/utils/async_client.jsx')
-rw-r--r-- | web/react/utils/async_client.jsx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index f35b0f6cc..b938216ac 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -81,6 +81,30 @@ module.exports.getChannels = function(force, updateLastViewed, checkVersion) { } } +module.exports.getChannel = function(id) { + if (isCallInProgress("getChannel"+id)) return; + + callTracker["getChannel"+id] = utils.getTimestamp(); + client.getChannel(id, + function(data, textStatus, xhr) { + callTracker["getChannel"+id] = 0; + + if (xhr.status === 304 || !data) return; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_CHANNEL, + channel: data.channel, + member: data.member + }); + + }, + function(err) { + callTracker["getChannel"+id] = 0; + dispatchError(err, "getChannel"); + } + ); +} + module.exports.updateLastViewedAt = function() { if (isCallInProgress("updateLastViewed")) return; |