From d40e61fc454a9c42d2ac69950074bf3504d484bf Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Wed, 14 Jun 2023 19:50:19 +0330 Subject: fix and improve --- web/html/xui/index.html | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'web/html/xui/index.html') diff --git a/web/html/xui/index.html b/web/html/xui/index.html index 9795e87d..989aa286 100644 --- a/web/html/xui/index.html +++ b/web/html/xui/index.html @@ -449,9 +449,13 @@ this.loadingTip = tip; }, async getStatus() { - const msg = await HttpUtil.post('/server/status'); - if (msg.success) { - this.setStatus(msg.obj); + try { + const msg = await HttpUtil.post('/server/status'); + if (msg.success) { + this.setStatus(msg.obj); + } + } catch (e) { + console.error("Failed to get status:", e); } }, setStatus(data) { @@ -560,11 +564,14 @@ }, }, async mounted() { - while (true) { + let retries = 0; + while (retries < 5) { try { await this.getStatus(); + retries = 0; } catch (e) { - console.error(e); + console.error("Error occurred while fetching status:", e); + retries++; } await PromiseUtil.sleep(2000); } -- cgit v1.2.3