fix(frontend): handle empty responses, credential 401s and keyboard superlike #196
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/frontend-api-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by comparing every call in
src/lib/api.tswith its backend handler.res.json()message/errorup, backend expectsSUPERLIKEVerified with
npm run check(0 errors) andnpm run build. Not exercised in a browser against a running backend.🤖 Generated with Claude Code
The API client parsed every 2xx body as JSON and treated every 401 as an expired session, which broke several flows against the real backend: - sign out (200, no body) threw, so the UI stayed logged in - subscribing from the feed (201, no body) reported failure after it had succeeded - a wrong password showed "Unauthorized" instead of the backend message - wrong credentials for the remote server in the migration wizard threw the user onto the login screen - errors without a message (e.g. {"code":"ALREADY_RUNNING"}) rendered as an empty string ArrowUp on Discover sent "up", which the backend rejects; it now sends SUPERLIKE like the buttons and the card's own key handler. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>