const BASE = 'http://localhost:8000' // GET /api/config returns a flat dict {key: value} — return it directly. export const fetchConfig = async (): Promise> => { const res = await fetch(`${BASE}/api/config`) if (!res.ok) throw new Error('Failed to fetch config') return res.json() } // POST /api/config expects a flat dict {key: value} — send data directly. export const saveConfig = async (data: Record): Promise => { const res = await fetch(`${BASE}/api/config`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data), }) if (!res.ok) throw new Error('Failed to save config') }