Add access token and wallet address to GitHub reward

This commit is contained in:
Alex Liebowitz 2017-03-30 00:48:18 -04:00 committed by Jeremy Kauffman
parent 6cc2892399
commit c374a59af8
2 changed files with 21 additions and 22 deletions

View file

@ -28,18 +28,13 @@ const mocks = {
};
lbryio.call = function(resource, action, params, method='get') {
console.log('top of lbryio.call')
return new Promise((resolve, reject) => {
console.log('top of promise handler')
/* temp code for mocks */
if (`${resource}.${action}` in mocks) {
console.log(`found ${resource}.${action} in mocks`)
resolve(mocks[`${resource}.${action}`](params));
console.log('...resolved.');
return;
} else {
console.log(`did not find ${resource}.${action} in mocks`);
}
/* end temp */
console.log('about to create xhr object');

View file

@ -13,22 +13,25 @@ const LinkGithubReward = React.createClass({
onClaimed: React.PropTypes.func,
},
_launchLinkPage: function() {
const githubAuthParams = {
/* const githubAuthParams = {
client_id: GITHUB_CLIENT_ID,
redirect_uri: 'https://lbry.io/',
scope: 'user:email,public_repo',
allow_signup: false,
}
shell.openExternal('https://github.com/login/oauth/authorize?' + querystring.stringify(githubAuthParams));
shell.openExternal('https://github.com/login/oauth/authorize?' + querystring.stringify(githubAuthParams)); */
shell.openExternal('https://lbry.io');
},
handleConfirmClicked: function() {
this.setState({
confirming: true,
});
lbry.get_new_address().then((address) => {
lbryio.call('reward', 'new', {
reward_type: 'new_developer',
access_token: 'token will go here',
access_token: '**access token here**',
wallet_address: address,
}, 'post').then((response) => {
console.log('response:', response);
@ -43,6 +46,7 @@ const LinkGithubReward = React.createClass({
confirming: false,
});
});
});
},
getInitialState: function() {
return {
@ -54,7 +58,7 @@ const LinkGithubReward = React.createClass({
<section>
<section className="reward-page__details">
<p><Link button="alt" label="Link with GitHub" onClick={this._launchLinkPage} /></p>
<p>This will open browser window where you can authorize GitHub to link your account to LBRY. This will record your email (no spam) and star the LBRY repo.</p>
<p>This will open a browser window where you can authorize GitHub to link your account to LBRY. This will record your email (no spam) and star the LBRY repo.</p>
<p>Once you're finished, you may confirm you've linked the account to receive your reward.</p>
</section>