From ca919538cc402ed90ce42ffc3ef98994bb1081f4 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 13 Aug 2015 13:01:21 -0400 Subject: Added ConfigStore that is populated from the server --- web/react/utils/async_client.jsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'web/react/utils/async_client.jsx') diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index f35b0f6cc..afb9a1d79 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -4,6 +4,7 @@ var client = require('./client.jsx'); var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var ChannelStore = require('../stores/channel_store.jsx'); +var ConfigStore = require('../stores/config_store.jsx'); var PostStore = require('../stores/post_store.jsx'); var UserStore = require('../stores/user_store.jsx'); var utils = require('./utils.jsx'); @@ -383,3 +384,28 @@ module.exports.getMyTeam = function() { } ); } + +function getConfig() { + if (isCallInProgress('getConfig')) { + return; + } + + callTracker['getConfig'] = utils.getTimestamp(); + client.getConfig( + function(data, textStatus, xhr) { + callTracker['getConfig'] = 0; + + if (data && xhr.status !== 304) { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_CONFIG, + settings: data + }); + } + }, + function(err) { + callTracker['getConfig'] = 0; + dispatchError(err, 'getConfig'); + } + ); +} +module.exports.getConfig = getConfig; -- cgit v1.2.3-1-g7c22