[Jifty-commit] jifty branch, jifty_client, updated. 889c3b3d5481f0abd80f964c8239f2edb8ea432d

Jifty commits jifty-commit at lists.jifty.org
Thu May 13 12:58:00 EDT 2010


The branch, jifty_client has been updated
       via  889c3b3d5481f0abd80f964c8239f2edb8ea432d (commit)
      from  75d4526822f5246b092407444ac7d0f715cf6c30 (commit)

Summary of changes:
 share/web/static/js/jifty_client.js |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 889c3b3d5481f0abd80f964c8239f2edb8ea432d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri May 14 01:58:08 2010 +0900

    Keep track of currentUser by running AboutMe after login

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index 968ceaf..c5fa2a0 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -72,17 +72,37 @@ Class("JiftyClient", {
         },
         password: {
             is: "rw"
+        },
+        currentUser: {
+            is: "rw"
         }
     },
     methods: {
         login: function (onSuccess, onFailure) {
+            var that = this;
             this.runAction(
                 "Login",
                 {
                     address:  this.email,
                     password: this.password
                 },
-                onSuccess,
+                function (result) {
+                    that.aboutMe(function () {
+                        onSuccess(result);
+                    }, onFailure);
+                },
+                onFailure
+            );
+        },
+        aboutMe: function (onSuccess, onFailure) {
+            var that = this;
+            this.runAction(
+                "AboutMe",
+                {},
+                function (result) {
+                    that.currentUser = result.content.current_user;
+                    onSuccess(result);
+                },
                 onFailure
             );
         },
@@ -158,7 +178,7 @@ Class("JiftyClient", {
             var record = c.meta.instantiate(result);
             record._original = result;
             return record;
-        },
+        }
     }
 });
 

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list