From 30fa0c4c1faece6b054105fe3cce5107f24a2fa2 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Sun, 3 Nov 2024 15:33:43 -0500
Subject: Svelte 5: go through and use runes in components, pages, and layouts.

Does not use runes in stores (yet).
---
 ui/lib/components/Invites.svelte | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

(limited to 'ui/lib/components/Invites.svelte')

diff --git a/ui/lib/components/Invites.svelte b/ui/lib/components/Invites.svelte
index bfaf2b6..337ee7e 100644
--- a/ui/lib/components/Invites.svelte
+++ b/ui/lib/components/Invites.svelte
@@ -1,24 +1,23 @@
 <script>
-	import { writable } from 'svelte/store';
 	import { createInvite } from '$lib/apiServer';
 	import Invite from '$lib/components/Invite.svelte';
 
-	let invites = writable([]);
-	$: $invites, console.log('invites', $invites);
+	let invites = $state([]);
 
-	async function onSubmit() {
+	async function onSubmit(event) {
+		event.preventDefault();
 		let response = await createInvite();
 		if (response.status == 200) {
-			invites.update((val) => [...val, response.data]);
+			invites.push(response.data);
 		}
 	}
 </script>
 
 <ul>
-	{#each $invites as invite}
+	{#each invites as invite}
 		<li><Invite id={invite.id} /></li>
 	{/each}
 </ul>
-<form on:submit|preventDefault={onSubmit}>
+<form onsubmit={onSubmit}>
 	<button class="btn variant-filled" type="submit"> Create Invitation </button>
 </form>
-- 
cgit v1.2.3

