const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || ''; export async function fetchApi(path: string) { const res = await fetch(`${API_BASE}${path}`); if (!res.ok) { const text = await res.text().catch(() => 'Unknown error'); throw new Error(`${path}: ${res.status} ${text}`); } return res.json(); }