apiClient.ts

Configured Axios HTTP client with authentication and error handling.

Features:

  • Base URL configuration via environment variable
  • Automatic JWT token attachment from localStorage
  • Request/response logging for debugging
  • 401 Unauthorized token cleanup
  • 2-minute request timeout

Interceptors:

  • Request: Attaches Bearer token to Authorization header
  • Response: Logs responses, handles 401 by removing token

Error Handling:

  • Logs all API errors
  • Clears token on 401 responses
  • Propagates errors to ErrorBoundary

Index

Functions