mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-03 13:44:47 +08:00
chore: update deps
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
import { AxiosRequestConfig } from "axios"
|
||||
import { excludeProps } from "./utils"
|
||||
import { AxiosRequestConfig } from "axios";
|
||||
import { excludeProps } from "./utils";
|
||||
/**
|
||||
* 默认配置
|
||||
*/
|
||||
export const defaultConfig: AxiosRequestConfig = {
|
||||
baseURL: '/api',
|
||||
baseURL: "",
|
||||
timeout: 10000, //10秒超时
|
||||
headers: {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export function genConfig(config?: AxiosRequestConfig): AxiosRequestConfig {
|
||||
if (!config) {
|
||||
return defaultConfig
|
||||
return defaultConfig;
|
||||
}
|
||||
|
||||
const { headers } = config
|
||||
const { headers } = config;
|
||||
if (headers && typeof headers === "object") {
|
||||
defaultConfig.headers = {
|
||||
...defaultConfig.headers,
|
||||
...headers
|
||||
}
|
||||
...headers,
|
||||
};
|
||||
}
|
||||
return { ...excludeProps(config!, "headers"), ...defaultConfig }
|
||||
return { ...excludeProps(config!, "headers"), ...defaultConfig };
|
||||
}
|
||||
|
||||
export const METHODS = ["post", "get", "put", "delete", "option", "patch"]
|
||||
export const METHODS = ["post", "get", "put", "delete", "option", "patch"];
|
||||
|
||||
Reference in New Issue
Block a user