src/utils/axios.ts. Service files in src/services/ import this default export.
Axios instance
/api/ suffix in production (see .env example: http://localhost:3005/api/).
Request interceptor
Attaches JWT fromlocalStorage 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):fetcher helper
SWR-compatible GET wrapper:
Service layer pattern
Services are thin wrappers — no business logic:baseURL (e.g. /zerodha/order → {baseURL}/zerodha/order).
Error handling in UI
Components typically use:err?.response?.data for MFA and force-login flows.