1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-28 18:59:39 +01:00
immich/web/src/routes/admin/server-status/+page.svelte
martin c602eaea4a
feat(web): automatically update user info ()
* use svelte store

* fix: websocket error when not authenticated

* more routes
2023-12-12 10:35:28 -06:00

30 lines
956 B
Svelte

<script lang="ts">
import ServerStatsPanel from '$lib/components/admin-page/server-stats/server-stats-panel.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { api } from '@api';
import { onDestroy, onMount } from 'svelte';
import type { PageData } from './$types';
export let data: PageData;
let setIntervalHandler: ReturnType<typeof setInterval>;
onMount(async () => {
setIntervalHandler = setInterval(async () => {
const { data: stats } = await api.serverInfoApi.getServerStatistics();
data.stats = stats;
}, 5000);
});
onDestroy(() => {
clearInterval(setIntervalHandler);
});
</script>
<UserPageLayout title={data.meta.title} admin>
<section id="setting-content" class="flex place-content-center sm:mx-4">
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
<ServerStatsPanel stats={data.stats} />
</section>
</section>
</UserPageLayout>