/** * CRM Frontend API-Wrapper * * Lightweight fetch() wrapper with: * - Automatic JWT injection (Authorization: Bearer from localStorage) * - 401 handling: clears token + redirects to /index.html * - JSON-only requests (FormData→x-www-form-urlencoded via postForm) * - ApiError class with status and parsed body for granular error handling * * All pages import this via