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/routes/(app)/me/+page.svelte | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

(limited to 'ui/routes/(app)/me/+page.svelte')

diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte
index 26537ad..4531a91 100644
--- a/ui/routes/(app)/me/+page.svelte
+++ b/ui/routes/(app)/me/+page.svelte
@@ -3,15 +3,16 @@
 
 	import Invites from '$lib/components/Invites.svelte';
 
-	let currentPassword = '',
-		newPassword = '',
-		confirmPassword = '',
+	let currentPassword = $state(''),
+		newPassword = $state(''),
+		confirmPassword = $state(''),
 		passwordForm;
-	let pending = false;
-	$: valid = newPassword === confirmPassword && newPassword !== currentPassword;
-	$: disabled = pending || !valid;
+	let pending = $state(false);
+	let valid = $derived(newPassword === confirmPassword && newPassword !== currentPassword);
+	let disabled = $derived(pending || !valid);
 
-	async function onPasswordChange() {
+	async function onPasswordChange(event) {
+		event.preventDefault();
 		pending = true;
 		let response = await changePassword(currentPassword, newPassword);
 		switch (response.status) {
@@ -23,7 +24,7 @@
 	}
 </script>
 
-<form on:submit|preventDefault={onPasswordChange} bind:this={passwordForm}>
+<form onsubmit={onPasswordChange} bind:this={passwordForm}>
 	<label
 		>current password
 		<input
-- 
cgit v1.2.3

