summaryrefslogtreecommitdiff
path: root/ui/lib/components/LogIn.svelte
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-02-24 11:41:24 -0500
committerOwen Jacobson <owen@grimoire.ca>2025-02-24 11:41:24 -0500
commit099471c574f6dceeb45f8bb5dae1699a734cb084 (patch)
tree945f44c9a90bf51de20c61a5a8c5ed82c2c05009 /ui/lib/components/LogIn.svelte
parent36cadfe00cacc6a6523f9862d3f7a08a9d0ce611 (diff)
parentfc0f1654a56d2247728a766f43e72ff169704888 (diff)
Merge branch 'prop/global-state-at-top-level'
Diffstat (limited to 'ui/lib/components/LogIn.svelte')
-rw-r--r--ui/lib/components/LogIn.svelte27
1 files changed, 18 insertions, 9 deletions
diff --git a/ui/lib/components/LogIn.svelte b/ui/lib/components/LogIn.svelte
index 5bfdae2..c49ea3b 100644
--- a/ui/lib/components/LogIn.svelte
+++ b/ui/lib/components/LogIn.svelte
@@ -1,20 +1,29 @@
<script>
- let {
- username = $bindable(),
- password = $bindable(),
- legend = 'sign in',
- disabled,
- onsubmit
- } = $props();
+ let { legend = 'sign in', logIn = async (username, password) => {} } = $props();
+
+ let username = $state();
+ let password = $state();
+ let disabled = $state(false);
+
+ async function onsubmit(event) {
+ event.preventDefault();
+ disabled = true;
+ try {
+ await logIn(username, password);
+ event.target.reset();
+ } finally {
+ disabled = false;
+ }
+ }
</script>
<div>
<form class="form" {onsubmit}>
- <label for="username">
+ <label>
username
<input name="username" type="text" placeholder="username" bind:value={username} {disabled} />
</label>
- <label for="password">
+ <label>
password
<input
name="password"