mirror of
https://github.com/Kizuren/statusPage.git
synced 2026-01-04 13:45:17 +01:00
18 lines
No EOL
543 B
JavaScript
18 lines
No EOL
543 B
JavaScript
document.addEventListener("DOMContentLoaded", async () => {
|
|
let $main = document.querySelector('main');
|
|
const refreshStatus = async () => {
|
|
try {
|
|
const response = await fetch('/status.json');
|
|
if (!response.ok) {
|
|
throw new Error(`Error fetching status.json: ${response.statusText}`);
|
|
}
|
|
const status = await response.json();
|
|
|
|
$main.innerHTML = template.render(status);
|
|
|
|
} catch (error) {
|
|
console.error("Error loading server status:", error);
|
|
}
|
|
};
|
|
setInterval(refreshStatus, 60_000); // Refresh every minute
|
|
}); |