perf:新增onHttpError,发布版本1.0.6
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiesheng/npm-tool",
|
"name": "@tiesheng/npm-tool",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "npm tool package",
|
"description": "npm tool package",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ async function req(url, options) {
|
|||||||
}
|
}
|
||||||
resolve(data)
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
|
GlobalConfig.getConfig().onHttpError(res);
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* 默认配置
|
* 默认配置
|
||||||
* @type {{prefix: string, encryptBody: boolean}}
|
* @type {{onHttpError: defaultConfig.onHttpError, prefix: string, base64Key: string, encryptBody: boolean}}
|
||||||
*/
|
*/
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
encryptBody: true,
|
encryptBody: true,
|
||||||
base64Key: "WmdUzPJXbngVNiaSsQrihg==",
|
base64Key: "WmdUzPJXbngVNiaSsQrihg==",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
|
onHttpError: (res) => {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user