From 48190d18be29ed2cb6878e6fc23ab5952580ea0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?netop=3A//=E3=82=A6=E3=82=A8=E3=83=8F?= Date: Mon, 9 Sep 2019 15:54:44 -0500 Subject: [PATCH] Debugging --- app/components/client/devprogram-scripts.js | 14 +++++++++----- app/sockets.js | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/components/client/devprogram-scripts.js b/app/components/client/devprogram-scripts.js index 0dc1f05..0f2d377 100644 --- a/app/components/client/devprogram-scripts.js +++ b/app/components/client/devprogram-scripts.js @@ -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}`) .then(response => response.json()) .then(result => { + console.log(result); + switch(true) { case result.error === "this reward is limited to 1 per person": document.querySelector("developer-program").innerHTML = "

You have already claimed this reward. This reward is limited to ONE per person. Your enthusiasm is appreciated.

"; - break; + return; case result.success: result = result.data; document.querySelector("developer-program").innerHTML = `

Success! Your wallet has been credited with ${result.reward_amount} LBC.

We have a great reference for the LBRY SDK here to help you get started.

You can see proof of this transaction on our Blockchain Explorer.

`; - break; + return; default: - console.log(data); // eslint-disable-line no-console + console.info(data); // eslint-disable-line no-console document.querySelector("developer-program").innerHTML = "

The LBRY API might be down. Please try again later.

"; - break; + return; } }) - .catch(() => { + .catch(error => { + console.error(error); + // Idk what the error would be (probably a 500) so let's just have this message document.querySelector("developer-program").innerHTML = "

LBRY API is down. Please try again later.

"; diff --git a/app/sockets.js b/app/sockets.js index b6f4d81..f73a2ba 100644 --- a/app/sockets.js +++ b/app/sockets.js @@ -15,11 +15,11 @@ import { generateGitHubFeed } from "~helper/github"; import messageSlack from "~helper/slack"; import { URL } from "url"; -const githubAppId = process.env.GITHUB_APP_ID; -const githubAppSecret = process.env.GITHUB_APP_SECRET; +// const githubAppId = process.env.GITHUB_APP_ID; +// const githubAppSecret = process.env.GITHUB_APP_SECRET; -// const githubAppId = process.env.GITHUB_APP_ID_TEST; -// const githubAppSecret = process.env.GITHUB_APP_SECRET_TEST; +const githubAppId = process.env.GITHUB_APP_ID_TEST; +const githubAppSecret = process.env.GITHUB_APP_SECRET_TEST;