Spaces:
Sleeping
Sleeping
| async function checkStatus() { | |
| const res = await fetch("/status"); | |
| const data = await res.json(); | |
| if (data.ready) { | |
| document.getElementById("loading").style.display = "none"; | |
| document.getElementById("app").style.display = "block"; | |
| } else { | |
| setTimeout(checkStatus, 2000); | |
| } | |
| } | |
| async function runQuery() { | |
| const sql = document.getElementById("sql").value; | |
| const res = await fetch("/query", { | |
| method: "POST", | |
| headers: {"Content-Type": "application/json"}, | |
| body: JSON.stringify({sql}) | |
| }); | |
| const data = await res.json(); | |
| document.getElementById("output").textContent = | |
| JSON.stringify(data, null, 2); | |
| } | |
| checkStatus(); | |