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/CreateChannelForm.svelte | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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

diff --git a/ui/lib/components/CreateChannelForm.svelte b/ui/lib/components/CreateChannelForm.svelte
index 6eee5db..ac43925 100644
--- a/ui/lib/components/CreateChannelForm.svelte
+++ b/ui/lib/components/CreateChannelForm.svelte
@@ -1,11 +1,12 @@
 <script>
 	import { createChannel } from '$lib/apiServer';
 
-	let name = '';
+	let name = $state('');
 	let pending = false;
-	$: disabled = pending;
+	let disabled = $derived(pending);
 
-	async function handleSubmit() {
+	async function handleSubmit(event) {
+		event.preventDefault();
 		pending = true;
 		const response = await createChannel(name);
 		if (200 <= response.status && response.status < 300) {
@@ -15,7 +16,7 @@
 	}
 </script>
 
-<form on:submit|preventDefault={handleSubmit} class="form form-row flex-nowrap">
+<form onsubmit={handleSubmit} class="form form-row flex-nowrap">
 	<input
 		type="text"
 		placeholder="create channel"
-- 
cgit v1.2.3

