diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-11 20:55:36 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-11 20:55:36 -0400 |
| commit | 5ff106e910544788bc916626ae7665cb26e5af30 (patch) | |
| tree | f03f98677293a9d892e2d21d1a9a80aeedab60a3 /ui/lib/components/LogIn.svelte | |
| parent | d33c8af14c4adc1c15ab048299e06f9f35ae4de6 (diff) | |
Provide a separate "initial setup" endpoint that creates a user.
Diffstat (limited to 'ui/lib/components/LogIn.svelte')
| -rw-r--r-- | ui/lib/components/LogIn.svelte | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/ui/lib/components/LogIn.svelte b/ui/lib/components/LogIn.svelte index e1cda8a..bb80ccd 100644 --- a/ui/lib/components/LogIn.svelte +++ b/ui/lib/components/LogIn.svelte @@ -1,27 +1,12 @@ <script> - import { goto } from '$app/navigation'; - import { logIn } from '$lib/apiServer'; - import { currentUser } from '$lib/store'; - - let disabled = false; - let username = ''; - let password = ''; - - async function handleLogin() { - disabled = true; - const response = await logIn(username, password); - if (200 <= response.status && response.status < 300) { - currentUser.update(() => ({ username })); - username = ''; - password = ''; - goto('/'); - } - disabled = false; - } + export let disabled = false; + export let username = ''; + export let password = ''; + export let legend = 'sign in'; </script> <div class="card m-4 p-4"> - <form on:submit|preventDefault={handleLogin}> + <form on:submit|preventDefault> <label class="label" for="username"> username <input class="input" name="username" type="text" placeholder="username" bind:value={username} disabled={disabled}> @@ -31,7 +16,7 @@ <input class="input" name="password" type="password" placeholder="password" bind:value={password} disabled={disabled}> </label> <button class="btn variant-filled" type="submit"> - sign in or up + {legend} </button> </form> </div> |
