const API_BASE = import.meta.env.VITE_API_BASE || "/api"; async function handleResponse(response) { if (!response.ok) { const errorText = await response.text(); throw new Error(errorText || `Request failed: ${response.status}`); } return response.json(); } export async function apiGet(path) { const response = await fetch(`${API_BASE}${path}`); return handleResponse(response); }