Skip to content

Commit

Permalink
fixing bug login dialog when exchangeToken
Browse files Browse the repository at this point in the history
  • Loading branch information
swznd committed Jan 3, 2013
1 parent 735d9d6 commit 3046069
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions js/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
})
}
Expand Down Expand Up @@ -103,7 +113,7 @@ this.user = (function() {
$.extend(datadb,resp);
model.set(datadb,'user',function() {
if($.isFunction(callback)) {
callback(true);
callback(resp.token);
}
})
});
Expand Down

0 comments on commit 3046069

Please sign in to comment.