Commit 162ff19e authored by 郑磊's avatar 郑磊

更新默认的请求配置项

parent 8ede0788
......@@ -66,18 +66,26 @@ const INTERNAL_OPTION_KEYS: (keyof ApiRequestDefaultOptions)[] = [
'signature_secret',
]
/**
* 默认的API请求配置
*/
export const DEFAULT_API_OPTIONS = {
source: 'xinxiuweb',
app_version: '1.0.0',
device: 'wap',
signature_secret: 'asdasgfdwqew',
method: 'POST',
}
/**
* 创建用于请求接口的Axios实例
*/
export function createAxiosInstance(
options: CreateInstanceDefaults = {
source: 'xinxiuweb',
app_version: '1.0.0',
device: 'wap',
signature_secret: 'asdasgfdwqew',
method: 'POST',
},
): ApiAxiosInstance {
export function createAxiosInstance(options: CreateInstanceDefaults = {}): ApiAxiosInstance {
options = {
...DEFAULT_API_OPTIONS,
...options,
}
const instance = axios.create(options)
//按倒序注入请求拦截器,最后处理的最先注入
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment