diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-11-15 10:14:41 -0500 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-11-15 10:14:41 -0500 |
| commit | 1635a4db77898e9394adaa104b4c53b94c59e2da (patch) | |
| tree | 041158bc15a1b83caaa245fbe60faf46e84a3070 /ui/routes/(app) | |
| parent | fefe76b35b6329cbcc92755a65e47c7f62f64690 (diff) | |
| parent | 2fb328089f01776e5bb553a1d50a061396588c8c (diff) | |
Merge branch 'main' into prop/shorter-expiry
Diffstat (limited to 'ui/routes/(app)')
| -rw-r--r-- | ui/routes/(app)/+layout.svelte | 4 | ||||
| -rw-r--r-- | ui/routes/(app)/me/+page.svelte | 84 |
2 files changed, 13 insertions, 75 deletions
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index 0a8c58d..86bc330 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -56,7 +56,7 @@ </script> <svelte:head> - <title>understory</title> + <title>pilcrow</title> </svelte:head> {#if loading} @@ -71,7 +71,7 @@ <CreateChannelForm /> </div> </nav> - <main> + <main class="pl-4"> {@render children?.()} </main> </div> diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte index 8d24a61..aded292 100644 --- a/ui/routes/(app)/me/+page.svelte +++ b/ui/routes/(app)/me/+page.svelte @@ -1,79 +1,17 @@ <script> - import { goto } from '$app/navigation'; - import { changePassword, logOut } from '$lib/apiServer.js'; - import { currentUser } from '$lib/store'; - + import LogOut from '$lib/components/LogOut.svelte'; import Invites from '$lib/components/Invites.svelte'; - - let currentPassword = $state(''), - newPassword = $state(''), - confirmPassword = $state(''), - passwordForm; - let pending = $state(false); - let valid = $derived(newPassword === confirmPassword && newPassword !== currentPassword); - let disabled = $derived(pending || !valid); - - async function onLogOut(event) { - event.preventDefault(); - const response = await logOut(); - if (200 <= response.status && response.status < 300) { - currentUser.update(() => null); - goto('/login'); - } - } - - async function onPasswordChange(event) { - event.preventDefault(); - pending = true; - let response = await changePassword(currentPassword, newPassword); - switch (response.status) { - case 200: - passwordForm.reset(); - break; - } - pending = false; - } + import ChangePassword from '$lib/components/ChangePassword.svelte'; </script> -<form onsubmit={onLogOut}> - <button class="btn variant-filled" type="submit">log out</button> -</form> - -<form onsubmit={onPasswordChange} bind:this={passwordForm}> - <label - >current password - <input - class="input" - name="currentPassword" - type="password" - placeholder="password" - bind:value={currentPassword} - /> - </label> - - <label - >new password - <input - class="input" - name="newPassword" - type="password" - placeholder="password" - bind:value={newPassword} - /> - </label> - - <label - >confirm new password - <input - class="input" - name="confirmPassword" - type="password" - placeholder="password" - bind:value={confirmPassword} - /> - </label> +<div class="mb-4"> + <ChangePassword /> +</div> - <button class="btn variant-filled" type="submit" {disabled}> change password </button> -</form> +<div class="mb-4"> + <Invites /> +</div> -<Invites /> +<div> + <LogOut /> +</div> |
