15 lines
625 B
JavaScript
15 lines
625 B
JavaScript
fetch("api/status", { cache: "no-store" })
|
|
.then((response) => response.ok ? response.json() : Promise.reject(new Error("status unavailable")))
|
|
.then((status) => {
|
|
const live = document.querySelector("#live-status");
|
|
const node = document.querySelector("#node-state");
|
|
live.textContent = "运行正常";
|
|
live.classList.add("ok");
|
|
node.textContent = `${status.node_id} · 在线`;
|
|
node.classList.add("ok");
|
|
})
|
|
.catch(() => {
|
|
document.querySelector("#live-status").textContent = "状态暂不可用";
|
|
document.querySelector("#node-state").textContent = "节点状态暂不可用";
|
|
});
|