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", "name": "@tiesheng/npm-tool",
"version": "1.0.13", "version": "1.0.14",
"description": "npm tool package", "description": "npm tool package",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

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

View File

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