25 lines
867 B
JavaScript
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");
|
|
});
|
|
|
|
}); |