Permalink
Browse files

fixing bug login dialog when exchangeToken

  • Loading branch information...
1 parent 735d9d6 commit 30460695588918db7946b432245e17a06a69d331 @swznd swznd committed Jan 3, 2013
Showing with 17 additions and 7 deletions.
  1. +17 −7 js/user.js
View
@@ -19,21 +19,31 @@ this.user = (function() {
else {
status = 'no_name';
}
+
+ if($.isFunction(callback)) {
+ callback(status,currentToken);
+ }
}
else {
exchangeToken(data, function(resp) {
- if(!resp) {
+ if(resp) {
+ status = 'ok';
+ currentToken = resp.token
+ }
+ else {
status = 'failed_exchange_token';
}
+
+ if($.isFunction(callback)) {
+ callback(status,currentToken);
+ }
});
}
}
else {
- status = 'no_user'
- }
-
- if($.isFunction(callback)) {
- callback(status);
+ if($.isFunction(callback)) {
+ callback('no_user');
+ }
}
})
}
@@ -103,7 +113,7 @@ this.user = (function() {
$.extend(datadb,resp);
model.set(datadb,'user',function() {
if($.isFunction(callback)) {
- callback(true);
+ callback(resp.token);
}
})
});

0 comments on commit 3046069

Please sign in to comment.