perf:新增GlobalConfig,发布版本1.0.4

This commit is contained in:
曾文豪
2023-03-17 12:43:47 +08:00
parent 580d7c5d62
commit 561be80efb
3 changed files with 34 additions and 33 deletions

28
src/utils/GlobalConfig.js Normal file
View 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
}