// Wrapper sobre $fetch que injeta o Authorization header automaticamente. export function useApi() { const { public: { apiBase } } = useRuntimeConfig() const token = useCookie('auth_token') function apiFetch(path: string, options: Parameters[1] = {}): Promise { return $fetch(`${apiBase}${path}`, { ...options, headers: { ...(options.headers as Record || {}), ...(token.value ? { Authorization: `Bearer ${token.value}` } : {}), }, }) } return { apiFetch } }