Breakthrough change
This commit is contained in:
@@ -102,17 +102,29 @@
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const HEALTH_URL = "http://localhost:3000/api/v1/system/health-check/";
|
||||
const FE_URL = "http://localhost:3000/";
|
||||
|
||||
async function checkBackend() {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 2500);
|
||||
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:3000/api/v1/health-check/",
|
||||
{ mode: "no-cors" },
|
||||
);
|
||||
window.location.href = "http://localhost:3000/";
|
||||
const res = await fetch(`${HEALTH_URL}?t=${Date.now()}`, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
clearTimeout(timeoutId);
|
||||
if (res.ok) {
|
||||
window.location.replace(FE_URL);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
setTimeout(checkBackend, 3000);
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
setTimeout(checkBackend, 2000);
|
||||
}
|
||||
|
||||
setTimeout(checkBackend, 1000);
|
||||
</script>
|
||||
</body>
|
||||
Reference in New Issue
Block a user