Overview
There is no API client of any kind in the frontend yet — app/ contains only a placeholder layout and page. Every subsequent page needs a single, consistent way to call the backend.
Tech
Use the native fetch API wrapped in a small typed client. No axios/TanStack Query — neither is currently installed, and this scope doesn't need them.
Acceptance Criteria
Overview
There is no API client of any kind in the frontend yet —
app/contains only a placeholder layout and page. Every subsequent page needs a single, consistent way to call the backend.Tech
Use the native
fetchAPI wrapped in a small typed client. Noaxios/TanStack Query — neither is currently installed, and this scope doesn't need them.Acceptance Criteria
lib/api-client.tsexporting arequest(path, options)helper that readsNEXT_PUBLIC_API_URL, attaches the JWT from the auth context (depends on FE-43) as a Bearer header, and parses JSON responses401response, attempt a silent refresh viaPOST /auth/refreshonce; if refresh also fails, clear the session and redirect to/loginApiErrorwithstatusandmessageextracted from the backend's error shape