# API Service Documentation ## Architecture - **HTTP Client**: Axios with custom wrapper - **Modular Structure**: Feature-based organization - **Type Safety**: TypeScript interfaces ## Auth Module ### Methods - `login(data)`: User authentication - Parameters: `{username, password}` - Returns: `{access_token}` - Content-Type: `application/json` - `register(formData)`: User registration - Parameters: FormData - Returns: `{user_id}` - Content-Type: `multipart/form-data` - `getPublicKey()`: Gets RSA public key - Returns: Public key string - Error Handling: Custom error messages - `refreshToken()`: Refreshes access token - Returns: New `{access_token}` ## Request Wrapper Located in `axios/service.ts`: - Base URL configuration - Request/response interceptors - Error handling - Type definitions ## Type Definitions Each module has corresponding type definitions: ```typescript // Example from auth/types.ts interface LoginParams { username: string password: string } ``` ## Error Handling - Custom error messages - Type-safe error responses - Console logging for debugging