Merge pull request #296 from lbryio/devprogram-fixes

Developer program fixes
This commit is contained in:
Thomas Zarebczan 2019-09-10 13:29:25 -04:00 committed by GitHub
commit ebbcb02c87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,22 +68,29 @@ function syncWithApi(data) { // eslint-disable-line no-unused-vars
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.error:
document.querySelector("developer-program").innerHTML =
`<p>${result.error}</p>`;
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>No success or error was received so the LBRY API might be down.<br/>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>";