Problem
The learner app targets users on unreliable mobile connectivity, but the API
client is not resilient. register.tsx swallows registration failures in an
empty catch with only a TODO (#44), stores do not persist (#38, #39), and
api.ts has no centralized 401 refresh-and-retry, no backoff for transient
network errors, and no offline request queue. A dropped connection during a
mutation is silently lost with no user feedback and no retry.
Before Starting
Read ALL of these before writing any code:
- context/architecture-context.md
- context/code-standards.md
What To Build
A resilient API client layer:
- An interceptor-based client with automatic 401 handling: refresh the token
once, retry the original request, and hard-logout on refresh failure.
- Exponential backoff with jitter for idempotent requests on transient
network/5xx errors, with a request-timeout ceiling.
- A durable offline mutation queue (secure/persisted storage) that captures
writes made while offline and replays them on reconnect, with per-request
idempotency keys to avoid duplicates.
- Consistent typed error surfacing so screens can show real feedback instead
of swallowing errors.
Files To Touch
- services/api.ts (interceptors, refresh, retry)
- src/offline/* (mutation queue + replay)
- app/register.tsx (real error handling)
- services/auth.service.ts
Acceptance Criteria
Mandatory Checks Before Opening PR
Problem
The learner app targets users on unreliable mobile connectivity, but the API
client is not resilient.
register.tsxswallows registration failures in anempty catch with only a TODO (#44), stores do not persist (#38, #39), and
api.tshas no centralized 401 refresh-and-retry, no backoff for transientnetwork errors, and no offline request queue. A dropped connection during a
mutation is silently lost with no user feedback and no retry.
Before Starting
Read ALL of these before writing any code:
What To Build
A resilient API client layer:
once, retry the original request, and hard-logout on refresh failure.
network/5xx errors, with a request-timeout ceiling.
writes made while offline and replays them on reconnect, with per-request
idempotency keys to avoid duplicates.
of swallowing errors.
Files To Touch
Acceptance Criteria
Mandatory Checks Before Opening PR