diff options
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> |
