File size: 458 Bytes
b794454
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
});