Added autoreload

This commit is contained in:
Manuel Forcén Muñoz 2024-05-21 22:59:26 +02:00
parent 1ad1e66470
commit c9e621571c
4 changed files with 29 additions and 0 deletions

View file

@ -34,5 +34,26 @@
{% endblock body %}
</div>
</div>
<script>
let state = {execution: null};
const check_exec = () => {
return fetch('/execution')
.then(response => response.text())
.then(data => parseInt(data))
.catch(err => {});
}
window.onload = () => {
check_exec().then(exec => {
state.execution = exec;
setInterval(()=>{
check_exec().then(exec => {
if(exec && state.execution != exec) {
location.reload();
}
});
}, 1000);
})
}
</script>
</body>
</html>