[open-ils-commits] r10148 - trunk/Open-ILS/web/js/dojo/openils
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Jul 27 11:09:29 EDT 2008
Author: erickson
Date: 2008-07-27 11:09:22 -0400 (Sun, 27 Jul 2008)
New Revision: 10148
Modified:
trunk/Open-ILS/web/js/dojo/openils/User.js
Log:
ported getbysession to fieldmapper.standardrequest to take advantage of default error handlers
Modified: trunk/Open-ILS/web/js/dojo/openils/User.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/User.js 2008-07-27 15:08:58 UTC (rev 10147)
+++ trunk/Open-ILS/web/js/dojo/openils/User.js 2008-07-27 15:09:22 UTC (rev 10148)
@@ -51,20 +51,25 @@
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;
}
More information about the open-ils-commits
mailing list