refactor: change usage of await

This commit is contained in:
Derrick Hammer 2023-07-27 03:00:00 -04:00
parent b1c2455f88
commit 514217451a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 16 additions and 10 deletions

View File

@ -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);
});
}
</script>
<main>
<Header />
<Art />
<div class="content" class:connected>
{#await waitConnect}
<div class="content connected">
{#await getNetworks() then types}
<div class="content-grid">
{#each Object.entries(types) as [type, networks]}
<div>