Description
The axios instance in lib/api-client.ts has no timeout configured. A hanging request will block the UI indefinitely with no feedback to the user. Additionally, API errors come back in different shapes ({ message }, { error }, plain strings) and each caller handles them differently.
Deliverables
Notes
No new dependencies — this uses only what axios already provides.
Description
The axios instance in
lib/api-client.tshas no timeout configured. A hanging request will block the UI indefinitely with no feedback to the user. Additionally, API errors come back in different shapes ({ message },{ error }, plain strings) and each caller handles them differently.Deliverables
timeout: 10_000(10 seconds) to the axios instance configuration inlib/api-client.tsparseApiError(err: unknown): stringhelper in the same file (orlib/errors.ts) that extracts a human-readable message from any axios error shapeerr.response.data.message(NestJS default)err.response.data.errorerr.message(network/timeout errors)'Something went wrong. Please try again.'parseApiErrornpm run buildpassesNotes
No new dependencies — this uses only what axios already provides.