// utils/apiFetch.js import { getAuthHeader } from './apiAuthHeader'; export async function apiFetch(url, options = {}) { const res = await fetch(url, { ...options, headers: { ...getAuthHeader(), ...(options.headers || {}), }, }); const json = await res.json(); if (!res.ok || !json.success) { throw new Error(json.message || 'Erro na requisição'); } return json.data; }