chore:1.0.14

This commit is contained in:
曾文豪
2023-11-01 12:01:53 +08:00
parent 77b361382e
commit 9d4016594a
3 changed files with 36 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@tiesheng/npm-tool",
"version": "1.0.13",
"version": "1.0.14",
"description": "npm tool package",
"main": "index.js",
"scripts": {

View File

@@ -99,10 +99,8 @@ async function req(url, options) {
let data = res.data;
if (res.encrypt) {
data = crypto.decrypt(data);
if (!Common.isEmpty(data)) {
data = Common.parseJSON(data, data);
}
}
resolve({data, recordsTotal: res.recordsTotal})
} else {
GlobalConfig.getConfig().onHttpError(res);

View File

@@ -32,14 +32,11 @@ const isEmpty = (value) => {
* @param def
*/
const parseJSON = (value, def = {}) => {
let obj;
let obj = def;
try {
obj = JSON.parse(value);
} catch (e) {
}
if (!obj) {
obj = def;
}
return obj;
};