Spaces:
Running
Running
Create static/user.js
Browse files- static/user.js +14 -0
static/user.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.getElementById("testApiButton").addEventListener("click", async function() {
|
2 |
+
// Prompt for the user API key
|
3 |
+
const apiKey = prompt("Enter your API key:");
|
4 |
+
|
5 |
+
const response = await fetch("/user/test_api", {
|
6 |
+
method: "GET",
|
7 |
+
headers: {
|
8 |
+
"X-API-Key": apiKey
|
9 |
+
}
|
10 |
+
});
|
11 |
+
|
12 |
+
const result = await response.json();
|
13 |
+
document.getElementById("apiResult").innerText = JSON.stringify(result, null, 2);
|
14 |
+
});
|