Niansuh's picture
Create static/user.js
b794454 verified
raw
history blame
458 Bytes
document.getElementById("testApiButton").addEventListener("click", async function() {
// Prompt for the user API key
const apiKey = prompt("Enter your API key:");
const response = await fetch("/user/test_api", {
method: "GET",
headers: {
"X-API-Key": apiKey
}
});
const result = await response.json();
document.getElementById("apiResult").innerText = JSON.stringify(result, null, 2);
});