From b7600cc3c9226e7efd5c6e4c9aed670a27cd8d70 Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Mon, 17 Apr 2023 07:09:10 -0500 Subject: [PATCH] fix: app now retries a couple of times if offline --- src/windows/main/Main.svelte | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/windows/main/Main.svelte b/src/windows/main/Main.svelte index c39332d8..68e768af 100644 --- a/src/windows/main/Main.svelte +++ b/src/windows/main/Main.svelte @@ -35,14 +35,18 @@ if (!selectedUser) selectedUser = Object.values(sUsers).find((user) => user.id32 == $activeUserId.toString())?.PersonaName; }); - await AppController.setup(); - - if (navigator.onLine) { - $isOnline = true; - } else { - const wantsToContinue = await AppController.promptOffline(); + let i = 0; + + while(!$isOnline && i < 4) { + if (navigator.onLine) $isOnline = true; + } + + await AppController.setup(); + + if (!$isOnline) { + const wantsToContinue = await AppController.promptOffline(); if (!wantsToContinue) exit(0); - } + } AppController.init(); });