Merge pull request 'server status' (#11) from feature/home-server-status-prometheus into main
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
+10
-2
@@ -39,8 +39,16 @@
|
||||
`).join("");
|
||||
};
|
||||
|
||||
fetch("/api/server-status", { cache: "no-store" })
|
||||
.then((res) => res.ok ? res.json() : null)
|
||||
const loadStatus = (url) => fetch(url, { cache: "no-store" })
|
||||
.then((res) => {
|
||||
if (!res.ok) {
|
||||
throw new Error(`status ${res.status}`);
|
||||
}
|
||||
return res.json();
|
||||
});
|
||||
|
||||
loadStatus(`/server-status.json?ts=${Date.now()}`)
|
||||
.catch(() => loadStatus("/api/server-status"))
|
||||
.then((data) => data && render(data))
|
||||
.catch(() => {});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user