All HTTP calls go through src/utils/axios.ts. Service files in src/services/ import this default export.

Axios instance

The base URL must include the /api/ suffix in production (see .env example: http://localhost:3005/api/).

Request interceptor

Attaches JWT from localStorage on every request:
JWTContext.setSession() also sets axios.defaults.headers.common.Authorization on login init for consistency.

Response interceptor

On 401 Unauthorized, redirects to login (unless already on login page):
Errors are re-thrown so callers can show snackbars.

fetcher helper

SWR-compatible GET wrapper:

Service layer pattern

Services are thin wrappers — no business logic:
Paths are relative to baseURL (e.g. /zerodha/order{baseURL}/zerodha/order).

Error handling in UI

Components typically use:
Login form reads err?.response?.data for MFA and force-login flows.