diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 2733df08..c4c59b3f 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -74,10 +74,15 @@ var CloudCommander, Util, DOM, $, Github; url:'/api/v1/auth', data: lCode, success: function(pData){ - if(pData) - GithubStore.Login(pData.token); + var lToken = pData.token; + + if(pData){ + GithubStore.Login(lToken); + + getUserData(lToken); } - }); + } + }); /* $.post("https://github.com/login/oauth/access_token",{ @@ -103,7 +108,25 @@ var CloudCommander, Util, DOM, $, Github; CLIENT_ID + '&&scope=repo,user,gist'; }; - cloudcmd.Storage.Keys = function(){ + function getUserData(pToken){ + var lHelloFunc = function(pData){ + var lName; + if(pData) + lName = ' ' + pData.name ; + + console.log('Hello' + lName + ' :)!'); + }; + + if(pToken) + $.ajax({ + url : 'https://api.github.com/user?access_token=' + pToken, + success : lHelloFunc + }); + else + lHelloFunc(); + } + + cloudcmd.Storage.Keys = function(){ DOM.jqueryLoad( Util.retLoadOnLoad([ init, setConfig, diff --git a/lib/client/storage/github/github.js b/lib/client/storage/github/github.js index 24764580..68b570ef 100644 --- a/lib/client/storage/github/github.js +++ b/lib/client/storage/github/github.js @@ -80,7 +80,9 @@ // ------- this.show = function(username, cb) { - _request("GET", "/users/"+username, null, function(err, res) { + var command = username ? "/users/"+username : "/user"; + + _request("GET", command, null, function(err, res) { cb(err, res); }); };