27 lines
526 B
Markdown
27 lines
526 B
Markdown
# @goodgo/http-client
|
|
|
|
HTTP client wrapper with Axios, automatic token management, and error handling.
|
|
|
|
## Usage
|
|
|
|
```typescript
|
|
import { createHttpClient } from '@goodgo/http-client';
|
|
|
|
const client = createHttpClient({
|
|
baseURL: 'http://api.example.com',
|
|
timeout: 30000,
|
|
});
|
|
|
|
// GET request
|
|
const response = await client.get('/users');
|
|
|
|
// POST request
|
|
const result = await client.post('/auth/login', {
|
|
email: 'user@example.com',
|
|
password: 'password',
|
|
});
|
|
|
|
// Set auth token
|
|
client.setAuthToken('your-token-here');
|
|
```
|