updated the login form to use use:enhance

This commit is contained in:
Patrick 2025-07-11 17:45:31 +02:00
parent 8df1c6ddc1
commit c207da0462
1 changed files with 4 additions and 2 deletions

View File

@ -1,12 +1,14 @@
<script lang="ts">
import type { PageProps } from "./$types";
import { enhance } from "$app/forms";
let { form }: PageProps = $props();
</script>
<div>
<h1>Login</h1>
<form id="login" method="POST" action="?/login">
<form id="login" method="POST" action="?/login" use:enhance={({formElement}) => { formElement.reset() }}>
<table>
<tbody>
<tr>
@ -15,7 +17,7 @@
</tr>
<tr>
<td><label for="password">Passwort:</label></td>
<td><input type="password" id="password" name="password" required /></td>
<td><input type="password" id="password" name="password" required /></td> <!-- form.password should never be defined -->
</tr>
<tr>
<td colspan="2"><button type="submit">Login</button></td>