feat: implement My Account page
Add /account route showing display name (from localStorage), role badge, session expiry decoded from JWT, and recovery PIN display with copy button. Join and recover flows now persist display_name to localStorage via setAuth(). Feed header logout button replaced with person-icon link to /account; logout is available from the account page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { getToken, clearAuth } from '$lib/auth';
|
||||
import { getToken } from '$lib/auth';
|
||||
import { api } from '$lib/api';
|
||||
import { connectSse, disconnectSse, onSseEvent } from '$lib/sse';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
@@ -152,11 +152,7 @@
|
||||
if (u) selectedUpload = u;
|
||||
}
|
||||
|
||||
async function handleLogout() {
|
||||
try { await api.delete('/session'); } catch { /* ignore */ }
|
||||
clearAuth();
|
||||
goto('/join');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="min-h-screen bg-gray-50">
|
||||
@@ -171,12 +167,15 @@
|
||||
>
|
||||
Hochladen
|
||||
</a>
|
||||
<button
|
||||
onclick={handleLogout}
|
||||
<a
|
||||
href="/account"
|
||||
class="text-sm text-gray-500 hover:text-gray-700"
|
||||
aria-label="Mein Konto"
|
||||
>
|
||||
Abmelden
|
||||
</button>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user