10 changed files with 97 additions and 8 deletions
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,21 @@
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
####### common ####### Copyright (c) 2021 mls-361 ################################################## MIT License ####### |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
|
||||
const $ = (function() { |
||||
const error = document.getElementById("error"); |
||||
|
||||
return { |
||||
showError: function(message) { |
||||
error.textContent = message; |
||||
error.style.display = "block"; |
||||
} |
||||
} |
||||
})(); |
||||
|
||||
/* |
||||
######################################################################################################## @(°_°)@ ####### |
||||
*/ |
||||
|
@ -0,0 +1,34 @@
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
####### dashboard ####### Copyright (c) 2021 mls-361 ############################################### MIT License ####### |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
|
||||
(function() { |
||||
const dashboard = document.getElementById("dashboard"); |
||||
|
||||
window.addEventListener("load", function(event) { |
||||
window.setInterval( |
||||
function() { |
||||
fetch("/dashboard/update").then(function(response) { |
||||
if (response.ok) { |
||||
response.text().then(function(html) { |
||||
dashboard.innerHTML = html; |
||||
}); |
||||
} else { |
||||
$.showError("Fetch error: invalid network response"); //////////////////////////////////////////
|
||||
} |
||||
}) |
||||
.catch(function(error) { |
||||
$.showError("Fetch error: " + error.message); //////////////////////////////////////////////////////
|
||||
}); |
||||
}, |
||||
3000 |
||||
); |
||||
}); |
||||
})(); |
||||
|
||||
/* |
||||
######################################################################################################## @(°_°)@ ####### |
||||
*/ |
||||
|
Loading…
Reference in new issue