summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-18 10:40:46 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-18 10:40:46 -0400
commit308c4f3ce9330f4ac04cc04495533e6f2ad87f53 (patch)
tree8b632d86e86855fe52e35ebf32d65a79db605e74 /web/react/utils
parent1dc3a5f26d95ca87f2bfe1a57caa4ac9b077434a (diff)
downloadchat-308c4f3ce9330f4ac04cc04495533e6f2ad87f53.tar.gz
chat-308c4f3ce9330f4ac04cc04495533e6f2ad87f53.tar.bz2
chat-308c4f3ce9330f4ac04cc04495533e6f2ad87f53.zip
added team store, team settings menu, and the ability to turn on valet feature from client
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx22
-rw-r--r--web/react/utils/client.jsx31
-rw-r--r--web/react/utils/constants.jsx3
3 files changed, 56 insertions, 0 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index bb7ca458f..7e230f288 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -355,3 +355,25 @@ module.exports.getStatuses = function() {
}
);
}
+
+module.exports.getMyTeam = function() {
+ if (isCallInProgress("getMyTeam")) return;
+
+ callTracker["getMyTeam"] = utils.getTimestamp();
+ client.getMyTeam(
+ function(data, textStatus, xhr) {
+ callTracker["getMyTeam"] = 0;
+
+ if (xhr.status === 304 || !data) return;
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECIEVED_TEAM,
+ team: data
+ });
+ },
+ function(err) {
+ callTracker["getMyTeam"] = 0;
+ dispatchError(err, "getMyTeam");
+ }
+ );
+}
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 786e6dcea..15b6ace91 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -811,3 +811,34 @@ module.exports.getStatuses = function(success, error) {
}
});
};
+
+module.exports.getMyTeam = function(success, error) {
+ $.ajax({
+ url: "/api/v1/teams/me",
+ dataType: 'json',
+ type: 'GET',
+ success: success,
+ ifModified: true,
+ error: function(xhr, status, err) {
+ e = handleError("getMyTeam", xhr, status, err);
+ error(e);
+ }
+ });
+};
+
+module.exports.updateValetFeature = function(data, success, error) {
+ $.ajax({
+ url: "/api/v1/teams/update_valet_feature",
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success: success,
+ error: function(xhr, status, err) {
+ e = handleError("updateValetFeature", xhr, status, err);
+ error(e);
+ }
+ });
+
+ module.exports.track('api', 'api_teams_update_valet_feature');
+};
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index 0a3b1db3d..3a45de790 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -27,6 +27,9 @@ module.exports = {
RECIEVED_STATUSES: null,
RECIEVED_MSG: null,
+
+ CLICK_TEAM: null,
+ RECIEVED_TEAM: null,
}),
PayloadSources: keyMirror({