Debugging
This commit is contained in:
parent
201f8a4a09
commit
48190d18be
2 changed files with 13 additions and 9 deletions
|
@ -64,26 +64,30 @@ function syncWithApi(data) { // eslint-disable-line no-unused-vars
|
||||||
fetch(`https://api.lbry.com/reward/new?github_token=${code}&reward_type=github_developer&wallet_address=${address}`)
|
fetch(`https://api.lbry.com/reward/new?github_token=${code}&reward_type=github_developer&wallet_address=${address}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
switch(true) {
|
switch(true) {
|
||||||
case result.error === "this reward is limited to 1 per person":
|
case result.error === "this reward is limited to 1 per person":
|
||||||
document.querySelector("developer-program").innerHTML =
|
document.querySelector("developer-program").innerHTML =
|
||||||
"<p>You have already claimed this reward. This reward is limited to <strong>ONE</strong> per person. Your enthusiasm is appreciated.</p>";
|
"<p>You have already claimed this reward. This reward is limited to <strong>ONE</strong> per person. Your enthusiasm is appreciated.</p>";
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case result.success:
|
case result.success:
|
||||||
result = result.data;
|
result = result.data;
|
||||||
document.querySelector("developer-program").innerHTML =
|
document.querySelector("developer-program").innerHTML =
|
||||||
`<p><strong>Success!</strong> Your wallet has been credited with ${result.reward_amount} LBC.</p><p>We have a great reference for the <a href="/api/sdk">LBRY SDK here</a> to help you get started.</p><p>You can see proof of this transaction on <a href="https://explorer.lbry.com/tx/${result.transaction_id}">our Blockchain Explorer</a>.</p>`;
|
`<p><strong>Success!</strong> Your wallet has been credited with ${result.reward_amount} LBC.</p><p>We have a great reference for the <a href="/api/sdk">LBRY SDK here</a> to help you get started.</p><p>You can see proof of this transaction on <a href="https://explorer.lbry.com/tx/${result.transaction_id}">our Blockchain Explorer</a>.</p>`;
|
||||||
break;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log(data); // eslint-disable-line no-console
|
console.info(data); // eslint-disable-line no-console
|
||||||
document.querySelector("developer-program").innerHTML =
|
document.querySelector("developer-program").innerHTML =
|
||||||
"<p><strong>The LBRY API might be down. Please try again later.</strong></p>";
|
"<p><strong>The LBRY API might be down. Please try again later.</strong></p>";
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
// Idk what the error would be (probably a 500) so let's just have this message
|
// Idk what the error would be (probably a 500) so let's just have this message
|
||||||
document.querySelector("developer-program").innerHTML =
|
document.querySelector("developer-program").innerHTML =
|
||||||
"<p><strong>LBRY API is down. Please try again later.</strong></p>";
|
"<p><strong>LBRY API is down. Please try again later.</strong></p>";
|
||||||
|
|
|
@ -15,11 +15,11 @@ import { generateGitHubFeed } from "~helper/github";
|
||||||
import messageSlack from "~helper/slack";
|
import messageSlack from "~helper/slack";
|
||||||
import { URL } from "url";
|
import { URL } from "url";
|
||||||
|
|
||||||
const githubAppId = process.env.GITHUB_APP_ID;
|
// const githubAppId = process.env.GITHUB_APP_ID;
|
||||||
const githubAppSecret = process.env.GITHUB_APP_SECRET;
|
// const githubAppSecret = process.env.GITHUB_APP_SECRET;
|
||||||
|
|
||||||
// const githubAppId = process.env.GITHUB_APP_ID_TEST;
|
const githubAppId = process.env.GITHUB_APP_ID_TEST;
|
||||||
// const githubAppSecret = process.env.GITHUB_APP_SECRET_TEST;
|
const githubAppSecret = process.env.GITHUB_APP_SECRET_TEST;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue