From b704e9489b21b3bec17f5c8b573a1724781ee6f7 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Fri, 14 Aug 2015 08:43:49 -0400
Subject: added google sign-in functionality to the client, with minor model
 modifications

---
 web/react/utils/client.jsx | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'web/react/utils/client.jsx')

diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 5aab80d01..ce044457a 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -279,24 +279,33 @@ module.exports.getAudits = function(userId, success, error) {
     });
 };
 
-module.exports.getMe = function(success, error) {
+module.exports.getMeSynchronous = function(success, error) {
+    var currentUser = null;
 
     $.ajax({
+        async: false,
         url: "/api/v1/users/me",
         dataType: 'json',
         contentType: 'application/json',
         type: 'GET',
-        success: success,
+        success: function gotUser(data, textStatus, xhr) {
+            currentUser = data;
+            if (success) {
+                success(data, textStatus, xhr);
+            }
+        },
         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("getMe", xhr, status, err);
+                    e = handleError('getMeSynchronous', xhr, status, err);
                     error(e);
                 };
             };
         }
     });
+
+    return currentUser;
 };
 
 module.exports.inviteMembers = function(data, success, error) {
-- 
cgit v1.2.3-1-g7c22

