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

更新默认的请求配置项

parent 8ede0788
...@@ -67,17 +67,25 @@ const INTERNAL_OPTION_KEYS: (keyof ApiRequestDefaultOptions)[] = [ ...@@ -67,17 +67,25 @@ const INTERNAL_OPTION_KEYS: (keyof ApiRequestDefaultOptions)[] = [
] ]
/** /**
* 创建用于请求接口的Axios实例 * 默认的API请求配置
*/ */
export function createAxiosInstance( export const DEFAULT_API_OPTIONS = {
options: CreateInstanceDefaults = {
source: 'xinxiuweb', source: 'xinxiuweb',
app_version: '1.0.0', app_version: '1.0.0',
device: 'wap', device: 'wap',
signature_secret: 'asdasgfdwqew', signature_secret: 'asdasgfdwqew',
method: 'POST', method: 'POST',
}, }
): ApiAxiosInstance {
/**
* 创建用于请求接口的Axios实例
*/
export function createAxiosInstance(options: CreateInstanceDefaults = {}): ApiAxiosInstance {
options = {
...DEFAULT_API_OPTIONS,
...options,
}
const instance = axios.create(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