mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
- English locale defaults; remove duplicate zh-only locale files - SM2 utility sharing with the web client where applicable |
||
|---|---|---|
| .. | ||
| request | ||
| README.md | ||
Request Library
The current project uses Alova as the only HTTP request library:
Usage
- Alova HTTP: Path (src/http/request/alova.ts)
- Example code: src/api/foo-alova.ts and src/api/foo.ts
- API documentation: https://alova.js.org/
Configuration
Alova instance is configured:
- Automatic Token authentication and refresh
- Unified error handling and prompts
- Support dynamic domain switching
- Built-in request/response interceptors
Usage Examples
import { http } from '@/http/request/alova'
// GET request
http.Get<ResponseType>('/api/path', {
params: { id: 1 },
headers: { 'Custom-Header': 'value' },
meta: { toast: false } // Disable error prompts
})
// POST request
http.Post<ResponseType>('/api/path', data, {
params: { query: 'param' },
headers: { 'Content-Type': 'application/json' }
})