perf:新增GlobalConfig,发布版本1.0.4
This commit is contained in:
28
src/utils/GlobalConfig.js
Normal file
28
src/utils/GlobalConfig.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 默认配置
|
||||
* @type {{prefix: string, encryptBody: boolean}}
|
||||
*/
|
||||
const defaultConfig = {
|
||||
encryptBody: true,
|
||||
base64Key: "WmdUzPJXbngVNiaSsQrihg==",
|
||||
prefix: "",
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网络请求配置
|
||||
*/
|
||||
const getConfig = () => {
|
||||
return window.httpConfig || defaultConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络请求配置
|
||||
* @param obj
|
||||
*/
|
||||
function setConfig(obj = defaultConfig) {
|
||||
window.httpConfig = {...getConfig(), ...obj};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setConfig, getConfig
|
||||
}
|
||||
Reference in New Issue
Block a user