Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2024-01-26 14:07:51 +00:00
parent 6e1d5a472e
commit a6d18f90bb
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

View File

@ -9,7 +9,7 @@ const rawResults = document.querySelector("#rawResults");
function find() { function find() {
let user = gh.value.toLowerCase(); let user = gh.value.toLowerCase();
if (user != "") { if (user != "") {
statusUpdate(`Fetching devstat score for '${user}'`, "info"); statusUpdate(`Fetching devstats score for '${user}'`, "info");
rawResultsWrapper.classList.add('hidden'); rawResultsWrapper.classList.add('hidden');
fetch("https://devstats.cncf.io/api/v1", { fetch("https://devstats.cncf.io/api/v1", {
method: "POST", method: "POST",
@ -26,15 +26,15 @@ function find() {
statusUpdate("", "info"); statusUpdate("", "info");
let score = data.number[0]; let score = data.number[0];
if (score) { if (score) {
result.innerHTML = score; result.innerHTML = score;
rawResults.innerText = JSON.stringify(data, "", 2) rawResults.innerText = JSON.stringify(data, "", 2)
rawResultsWrapper.classList.remove('hidden'); rawResultsWrapper.classList.remove('hidden');
} else { } else {
statusUpdate(`Failed to get devstat score for '${user}'`, "error"); statusUpdate(`Failed to get devstats score for '${user}'`, "error");
} }
}) })
.catch(err => { .catch(err => {
statusUpdate(`Failed to get devstat score for '${user}'`, "error"); statusUpdate(`Failed to get devstats score for '${user}'`, "error");
console.log(err); console.log(err);
}); });
} }
@ -52,4 +52,4 @@ gh.onkeypress = function(event) {
} }
} }
btn.onclick = find; btn.onclick = find;