From 514217451a22ff13eddd72749c72ca303b969fc8 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 27 Jul 2023 03:00:00 -0400 Subject: [PATCH] refactor: change usage of await --- ui/apps/dashboard/App.svelte | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/ui/apps/dashboard/App.svelte b/ui/apps/dashboard/App.svelte index bf220a1..c457019 100644 --- a/ui/apps/dashboard/App.svelte +++ b/ui/apps/dashboard/App.svelte @@ -11,24 +11,30 @@ let connected = false; - let types = {}; + async function getNetworks() { + let types = {}; - const waitConnect = waitForConnected(async () => { - connected = true; + return new Promise((resolve) => { + waitForConnected(async () => { + connected = true; - const types = await networkClient.getTypes(); + const allTypes = await networkClient.getTypes(); - for (const type of types) { - types[type] = await networkClient.getNetworksByType(type); - } - }); + for (const type of allTypes) { + types[type] = await networkClient.getNetworksByType(type); + } + }); + + resolve(types); + }); + }
-
- {#await waitConnect} +
+ {#await getNetworks() then types}
{#each Object.entries(types) as [type, networks]}