summaryrefslogtreecommitdiffstats
path: root/web/react/utils/client.jsx
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-08-06 11:05:13 -0700
committernickago <ngonella@calpoly.edu>2015-08-06 11:44:13 -0700
commit3815ab806585afa205c074c0b40ddc31e4314190 (patch)
treeeb606b7763f70f0c5171716e9f4d0405f193714c /web/react/utils/client.jsx
parent3f987db4a5a3aacbe40ad6105e55341355ff0943 (diff)
downloadchat-3815ab806585afa205c074c0b40ddc31e4314190.tar.gz
chat-3815ab806585afa205c074c0b40ddc31e4314190.tar.bz2
chat-3815ab806585afa205c074c0b40ddc31e4314190.zip
Added keys to array-based elements and made getMe asynchronous
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r--web/react/utils/client.jsx14
1 files changed, 3 insertions, 11 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index b8eda0075..3375da7cf 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -279,32 +279,24 @@ module.exports.getAudits = function(userId, success, error) {
});
};
-module.exports.getMeSynchronous = function(success, error) {
-
- var current_user = null;
+module.exports.getMe = function(success, error) {
$.ajax({
- async: false,
url: "/api/v1/users/me",
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: function(data, textStatus, xhr) {
- current_user = data;
- if (success) success(data, textStatus, xhr);
- },
+ success: success,
error: function(xhr, status, err) {
var ieChecker = window.navigator.userAgent; // This and the condition below is used to check specifically for browsers IE10 & 11 to suppress a 200 'OK' error from appearing on login
if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) {
if (error) {
- e = handleError("getMeSynchronous", xhr, status, err);
+ e = handleError("getMe", xhr, status, err);
error(e);
};
};
}
});
-
- return current_user;
};
module.exports.inviteMembers = function(data, success, error) {