import type { SessionUser } from '#shared/types'; export type Session = { user: SessionUser | null; plan: string }; /** Fetch the current session (user + plan) once per request and share it across components. */ export function useSession() { return useAsyncData( 'session', async () => { try { return await $fetch('/api/auth/me'); } catch { return { user: null, plan: 'free' }; } }, { default: () => ({ user: null, plan: 'free' }) }, ); }