fix(auth): handle users without household — fallback to 'Kein Haushalt'

Removes non-null assertions on householdId/householdName. Users who
haven't joined a household get a fallback name in the sidebar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 13:58:37 +02:00
parent 32550377aa
commit aeaca76534
3 changed files with 34 additions and 4 deletions

View File

@@ -39,11 +39,11 @@ export const handle: Handle = async ({ event, resolve }) => {
event.locals.benutzer = {
id: user.id!,
name: user.displayName!,
rolle: user.householdRole as 'planer' | 'mitglied'
rolle: (user.householdRole as 'planer' | 'mitglied') ?? 'mitglied'
};
event.locals.haushalt = {
id: user.householdId!,
name: user.householdName!
id: user.householdId ?? undefined,
name: user.householdName ?? 'Kein Haushalt'
};
return resolve(event);