Files
test1/http/request.ts
2026-03-20 07:33:46 +00:00

23 lines
469 B
TypeScript

import { HTTPClient } from '@/http'
const CLIENT_API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || '/api'
export const request = new HTTPClient(
{
baseURL: CLIENT_API_BASE_URL,
headers: {
'Content-Type': 'application/json',
},
},
{
onRequest: async config => config,
onError: (error, config) => {
console.error('request error', {
method: config.method,
url: config.url,
error,
})
},
},
)