Przejdź do głównej zawartości

Interface: AuthStore

Properties​

accessToken​

accessToken: string | null


clearAuth​

clearAuth: () => void

Returns​

void


customer​

customer: CustomerInfo | null


expiresAt​

expiresAt: string | null

Absolute session expiry (ISO 8601) from the latest authoritative response (login / refresh / whoami), or null when unknown. Runtime-only — NEVER persisted to localStorage (the readable session-expiry cookie is the cold-start hint; this value is re-synced from the backend on each response).


isAuthenticated​

isAuthenticated: boolean


isLoading​

isLoading: boolean


seedSessionHint​

seedSessionHint: (expiresAt) => void

Mark the buyer authenticated from the cold-start session hint (the readable session-expiry cookie) — no token yet, so the store enters the "settling" state and the refresh scheduler recovers the session. Applied AFTER hydration (never during the first render) so server and client markup stay identical. No-op when the buyer is already authenticated or holds a token.

Parameters​

expiresAt​

string

Returns​

void


setAuth​

setAuth: (customer, accessToken, expiresAt?) => void

Parameters​

customer​

CustomerInfo | null

accessToken​

string

expiresAt?​

string | null

Returns​

void


setExpiresAt​

setExpiresAt: (expiresAt) => void

Sync just the session expiry from an authoritative backend response (whoami / refresh) without touching the token or customer — used when the locally-known expiry diverges from the backend's view.

Parameters​

expiresAt​

string | null

Returns​

void


setLoading​

setLoading: (isLoading) => void

Parameters​

isLoading​

boolean

Returns​

void


updateCustomer​

updateCustomer: (updates) => void

Parameters​

updates​

Partial<CustomerInfo>

Returns​

void