export const API_BASE = "http://127.0.0.1:5000"; export async function getHealth() { const res = await fetch(`${API_BASE}/health`); if (!res.ok) throw new Error(`health failed: ${res.status}`); return res.json(); } export async function startSimulation(payload) { const res = await fetch(`${API_BASE}/api/simulation/start`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload || {}) }); if (!res.ok) throw new Error(`start failed: ${res.status}`); return res.json(); } export async function stopSimulation(simulationId) { const res = await fetch(`${API_BASE}/api/simulation/${encodeURIComponent(simulationId)}/stop`, { method: "POST" }); if (!res.ok) throw new Error(`stop failed: ${res.status}`); return res.json(); }