fix(frontend): handle empty responses, credential 401s and keyboard superlike #196

Merged
midas merged 1 commit from fix/frontend-api-contract into main 2026-12-01 12:11:52 +01:00
Owner

Found by comparing every call in src/lib/api.ts with its backend handler.

Flow Was Cause
Sign out button appeared to do nothing backend answers 200 without a body; client did res.json()
Subscribe from Feed "Failed to subscribe" although it succeeded, retry gave 409 201 without a body
Wrong password showed "Unauthorized" 401 body was never read
Wrong remote credentials in migration wizard thrown onto the login screen every 401 treated as expired session
Errors without message/error empty message no fallback
ArrowUp on Discover "Failed to record swipe" sent up, backend expects SUPERLIKE

Verified with npm run check (0 errors) and npm run build. Not exercised in a browser against a running backend.

🤖 Generated with Claude Code

Found by comparing every call in `src/lib/api.ts` with its backend handler. | Flow | Was | Cause | |---|---|---| | Sign out | button appeared to do nothing | backend answers 200 without a body; client did `res.json()` | | Subscribe from Feed | "Failed to subscribe" although it succeeded, retry gave 409 | 201 without a body | | Wrong password | showed "Unauthorized" | 401 body was never read | | Wrong remote credentials in migration wizard | thrown onto the login screen | every 401 treated as expired session | | Errors without `message`/`error` | empty message | no fallback | | ArrowUp on Discover | "Failed to record swipe" | sent `up`, backend expects `SUPERLIKE` | Verified with `npm run check` (0 errors) and `npm run build`. Not exercised in a browser against a running backend. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(frontend): handle empty responses, credential 401s and keyboard superlike
All checks were successful
Build and Publish / frontend (push) Successful in 15s
Build and Publish / mcp (push) Successful in 15s
Build and Publish / backend (push) Successful in 2m56s
Build and Publish / publish (push) Has been skipped
4307d17b5c
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>
midas merged commit 2be7385a7e into main 2026-12-01 12:11:52 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midas/podradar!196
No description provided.