<script lang="ts">
	import ProjectCard from '$lib/card-collections/cards/ProjectCard.svelte';
	import Header from '$lib/header.svelte';

	const title: string = "Stuff I've Done";

	async function getProjects() {
		return await (await fetch('/projects/all')).json();
	}
</script>

<Header {title} />

{#await getProjects()}
	<p class="messages">Fetching projects</p>
{:then projects}
	{#each projects as project}
		<ProjectCard {project} />
	{/each}
{:catch}
	<p class="messages">Error fetching projects</p>
{/await}
