2024-08-10 23:10:03 +02:00
|
|
|
// NOTE: The server never fulfills this request, it stalls forever.
|
|
|
|
// Once the connection is closed, we try to connect with the server until we establish a successful
|
|
|
|
// connection. Then we reload the page.
|
2024-08-25 12:53:53 +02:00
|
|
|
await fetch("/auto-reload/stall").catch(async () => {
|
2024-08-10 23:10:03 +02:00
|
|
|
while (true) {
|
|
|
|
try {
|
2024-08-25 12:53:53 +02:00
|
|
|
let response = await fetch("/auto-reload/back-up");
|
2024-08-10 23:10:03 +02:00
|
|
|
if (response.status == 200) {
|
|
|
|
window.location.reload();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|