summaryrefslogtreecommitdiffstats
path: root/web/react/utils/async_client.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils/async_client.jsx')
-rw-r--r--web/react/utils/async_client.jsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index a903f055b..3f084578a 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -637,3 +637,32 @@ export function getMyTeam() {
}
);
}
+
+export function getDirectChannels() {
+ if (isCallInProgress('getDirectChannels')) {
+ return;
+ }
+
+ callTracker.getDirectChannels = utils.getTimestamp();
+ client.getPreferencesByName(
+ 'direct_channels',
+ 'show_hide',
+ (data, textStatus, xhr) => {
+ callTracker.getDirectChannels = 0;
+
+ if (xhr.status === 304 || !data) {
+ return;
+ }
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECIEVED_PREFERENCES,
+ preferences: data
+ });
+ },
+ (err) => {
+ callTracker.getDirectChannels = 0;
+ dispatchError(err, 'getDirectChannels');
+ }
+ );
+}
+