ported getbysession to fieldmapper.standardrequest to take advantage of default error...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 27 Jul 2008 15:09:22 +0000 (15:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 27 Jul 2008 15:09:22 +0000 (15:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10148 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/User.js

index 8dd7b44..0b09011 100644 (file)
@@ -51,20 +51,25 @@ if(!dojo._hasResource["openils.User"]) {
 
         getBySession : function(onComplete) {
             var _u = this;
-            var req = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.session.retrieve', _u.authtoken);
+            var req = ['open-ils.auth', 'open-ils.auth.session.retrieve'];
+            var params = [_u.authtoken];
+
             if(onComplete) {
-                req.oncomplete = function(r) {
-                    var user = r.recv().content();
-                    _u.user = user;
-                                       if (!openils.User.user) openils.User.user = _u.user;
-                    if(onComplete)
-                        onComplete(user);
-                }
-                req.send();
+                fieldmapper.standardRequest(
+                    req, {   
+                        async: true,
+                        params: params,
+                        oncomplete : function(r) {
+                            var user = r.recv().content();
+                            _u.user = user;
+                                               if (!openils.User.user) openils.User.user = _u.user;
+                            if(onComplete)
+                                onComplete(user);
+                        }
+                    }
+                );
             } else {
-                req.timeout = 10;
-                req.send();
-                _u.user = req.recv().content();
+                _u.user = fieldmapper.standardRequest(req, params);
                                if (!openils.User.user) openils.User.user = _u.user;
                 return _u.user;
             }