chore:1.0.14
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tiesheng/npm-tool",
|
||||
"version": "1.0.13",
|
||||
"version": "1.0.14",
|
||||
"description": "npm tool package",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user