You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
import { AxiosConfig, AxiosResponse } from './type'
|
|
|
|
|
|
|
|
|
|
|
|
const config: AxiosConfig = {
|
|
|
|
|
|
/**
|
|
|
|
|
|
* api请求基础路径
|
|
|
|
|
|
*/
|
|
|
|
|
|
baseUrl: {
|
|
|
|
|
|
// 开发环境接口前缀
|
|
|
|
|
|
base: '',
|
|
|
|
|
|
|
|
|
|
|
|
// 打包开发环境接口前缀
|
|
|
|
|
|
dev: '',
|
|
|
|
|
|
|
|
|
|
|
|
// 打包生产环境接口前缀
|
|
|
|
|
|
pro: '',
|
|
|
|
|
|
|
|
|
|
|
|
// 打包测试环境接口前缀
|
|
|
|
|
|
test: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 接口成功返回状态码
|
|
|
|
|
|
*/
|
|
|
|
|
|
code: '0000',
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 接口请求超时时间
|
|
|
|
|
|
*/
|
|
|
|
|
|
timeout: 60000,
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 默认接口请求类型
|
|
|
|
|
|
* 可选值:application/x-www-form-urlencoded multipart/form-data
|
|
|
|
|
|
*/
|
|
|
|
|
|
defaultHeaders: 'application/json',
|
|
|
|
|
|
|
|
|
|
|
|
interceptors: {
|
|
|
|
|
|
requestInterceptors: (config) => {
|
|
|
|
|
|
return config
|
|
|
|
|
|
},
|
|
|
|
|
|
// 响应拦截器
|
|
|
|
|
|
responseInterceptors: (result: AxiosResponse) => {
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default config
|