// Typed wrapper around $fetch with the configured API base. // Usage: const events = await useApi('/events') export async function useApi( path: string, opts: { method?: string; body?: unknown; query?: Record } = {}, ): Promise { const config = useRuntimeConfig() const base = config.public.apiBase as string return await $fetch(path, { baseURL: base, method: (opts.method ?? 'GET') as any, body: opts.body, query: opts.query, headers: { 'Content-Type': 'application/json' }, }) }