fix: make Navigation read from reactive authStore
use authStore.isAuthenticated instead of static server prop ensures nav updates when auth state changes client-side
This commit is contained in:
parent
657b3512b6
commit
0e0bf5e15a
1 changed files with 3 additions and 1 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
import type { UserCookie } from '$lib/types/UserCookie'
|
import type { UserCookie } from '$lib/types/UserCookie'
|
||||||
import { getAvatarSrc, getAvatarSrcSet } from '$lib/utils/avatar'
|
import { getAvatarSrc, getAvatarSrcSet } from '$lib/utils/avatar'
|
||||||
import UserSettingsModal from './UserSettingsModal.svelte'
|
import UserSettingsModal from './UserSettingsModal.svelte'
|
||||||
|
import { authStore } from '$lib/stores/auth.store'
|
||||||
|
|
||||||
// Props from layout data
|
// Props from layout data
|
||||||
const {
|
const {
|
||||||
|
|
@ -29,7 +30,8 @@
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const username = $derived(account?.username ?? '')
|
const username = $derived(account?.username ?? '')
|
||||||
const isAuth = $derived(Boolean(isAuthProp))
|
// Use reactive authStore instead of static server prop for real-time auth state
|
||||||
|
const isAuth = $derived($authStore.isAuthenticated)
|
||||||
const role = $derived(account?.role ?? null)
|
const role = $derived(account?.role ?? null)
|
||||||
// Element from UserCookie is already a string like "fire", "water", etc.
|
// Element from UserCookie is already a string like "fire", "water", etc.
|
||||||
const userElement = $derived(
|
const userElement = $derived(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue