From e6ee3f0a4287f3d2181f6b1d0a80bb9bdf47623c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Thu, 25 Jan 2024 15:47:27 +0100 Subject: [PATCH] Refactor login redirection logic in setup.html --- src/ui/templates/setup.html | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ui/templates/setup.html b/src/ui/templates/setup.html index 1463a72bf..0146a2ff7 100644 --- a/src/ui/templates/setup.html +++ b/src/ui/templates/setup.html @@ -629,16 +629,18 @@ setTimeout(() => { window.open(`${api}/login`, "_self"); }, 60000); - setInterval(() => { - fetch(`${api}/check`, { - cache: "no-cache", - }) - .then((res) => { - if (res.status === 200) { - window.open(`${api}/login`, "_self"); - } + setTimeout(() => { + setInterval(() => { + fetch(`${api}/check`, { + cache: "no-cache", }) - .catch((err) => {}); + .then((res) => { + if (res.status === 200) { + window.open(`${api}/login`, "_self"); + } + }) + .catch((err) => {}); + }, 1000); }, 5000); } })