summaryrefslogtreecommitdiffstats
path: root/web/react/utils/client.jsx
diff options
context:
space:
mode:
authorJack <jackdeng@gmail.com>2015-09-28 08:14:57 -0700
committerJack <jackdeng@gmail.com>2015-09-28 08:14:57 -0700
commit503501ab3b616fb9fa57b046df850cfc2db734f8 (patch)
tree43e529250bab982c73816f1ffdf673e8e4b98c13 /web/react/utils/client.jsx
parentaa6da728baf2f5642293d8b56ebc1ff4e8682bce (diff)
parenta055fd10b83b28bf97877e4e28a2275f74a71a4a (diff)
downloadchat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.gz
chat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.bz2
chat-503501ab3b616fb9fa57b046df850cfc2db734f8.zip
rebase
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r--web/react/utils/client.jsx48
1 files changed, 30 insertions, 18 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index a19f58e61..715e26197 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -27,7 +27,7 @@ function handleError(methodName, xhr, status, err) {
msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err;
if (xhr.status === 0) {
- e = {message: 'There appears to be a problem with your internet connection'};
+ e = {message: 'There appears to be a problem with your internet connection', connErrorCount: 1};
} else {
e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'};
}
@@ -347,6 +347,20 @@ export function testEmail(config, success, error) {
});
}
+export function getAllTeams(success, error) {
+ $.ajax({
+ url: '/api/v1/teams/all',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'GET',
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('getAllTeams', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function getMeSynchronous(success, error) {
var currentUser = null;
$.ajax({
@@ -890,6 +904,21 @@ export function getProfiles(success, error) {
});
}
+export function getProfilesForTeam(teamId, success, error) {
+ $.ajax({
+ cache: false,
+ url: '/api/v1/users/profiles/' + teamId,
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'GET',
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('getProfilesForTeam', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function uploadFile(formData, success, error) {
var request = $.ajax({
url: '/api/v1/files/upload',
@@ -1013,23 +1042,6 @@ export function getMyTeam(success, error) {
});
}
-export function updateValetFeature(data, success, error) {
- $.ajax({
- url: '/api/v1/teams/update_valet_feature',
- dataType: 'json',
- contentType: 'application/json',
- type: 'POST',
- data: JSON.stringify(data),
- success,
- error: function onError(xhr, status, err) {
- var e = handleError('updateValetFeature', xhr, status, err);
- error(e);
- }
- });
-
- track('api', 'api_teams_update_valet_feature');
-}
-
export function registerOAuthApp(app, success, error) {
$.ajax({
url: '/api/v1/oauth/register',