adjust to new api

This commit is contained in:
Akis 2022-12-13 17:37:58 +02:00
parent 5a76748208
commit 5ab0e2ecdc
Signed by untrusted user: akis
GPG Key ID: 267BF5C6677944ED
2 changed files with 57 additions and 46 deletions

View File

@ -2,5 +2,8 @@ import type { PageServerLoad } from "./$types";
import { env } from "$env/dynamic/private";
export const load: PageServerLoad = async () => {
return await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json());
return {
state: await fetch(env.VITE_API_URL + "/api/v1/state/status").then((res) => res.json()),
instances: await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json())
}
}

View File

@ -13,10 +13,12 @@
</svelte:head>
<h1>Our instances</h1>
{#if data.state.enabled}
<div class="flex flex-col gap-4">
<CardOuter>
<div class="wrapper">
{#each data.status as group}
{#each data.instances.status as group}
<h2>{group.name}</h2>
<div class="items">
{#each group.data as item}
@ -44,7 +46,7 @@
</CardOuter>
<span>Last updated: {dayjs
.unix(data.updated)
.unix(data.instances.updated)
.format("DD/MM/YYYY HH:mm:ss")}
</span>
</div>
@ -62,3 +64,9 @@
gap: 2rem;
}
</style>
{:else}
<div class="flex items-center gap-1 mt-16">
<div class="i-fa6-solid:circle-info" />
<span>Instances are currently disabled.</span>
</div>
{/if}