Files
geoip_block_generator/static/js/base.js
Mateusz Gruszczyński 721ad44960 api docs, generator
2026-03-03 10:03:34 +01:00

25 lines
867 B
JavaScript

document.addEventListener("DOMContentLoaded", function () {
const dot = document.getElementById("apiStatusDot");
const text = document.getElementById("apiStatusText");
if (!dot || !text) return;
fetch("/health", { method: "GET" })
.then(response => {
if (!response.ok) throw new Error("API not healthy");
dot.classList.remove("bg-secondary");
dot.classList.add("bg-success");
text.textContent = "API Online";
text.classList.remove("text-muted");
text.classList.add("text-success");
})
.catch(() => {
dot.classList.remove("bg-secondary");
dot.classList.add("bg-danger");
text.textContent = "API Offline";
text.classList.remove("text-muted");
text.classList.add("text-danger");
});
});