<script lang="ts">
	import apiFetch from "$lib/api";
	import { onMount } from "svelte";

	let guildCount: number | null = 0;

	type MetaResponse = { guilds: number };

	onMount(async () => {
		const meta = await apiFetch<MetaResponse>("GET", "/api/meta");
		guildCount = meta.guilds;
	});
</script>

<svelte:head>
	<title>Catalogger</title>
</svelte:head>

<h1>Welcome to SvelteKit</h1>
<p>
	Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation
</p>

<p>
	In {guildCount ?? "(loading)"} servers!
</p>
