// eslint-disable-next-line @typescript-eslint/no-explicit-any const cfg = (window as any).accessmateConfig ?? {}; const BASE = cfg.restBase ?? '/wp-json/accessmate/v1'; const NONCE = cfg.nonce ?? ''; export async function apiFetch(path: string, options: RequestInit = {}): Promise { const res = await fetch(BASE + path, { ...options, headers: { 'Content-Type': 'application/json', 'X-WP-Nonce': NONCE, ...options.headers, }, }); if (!res.ok) throw new Error(await res.text()); return res.json() as Promise; }