fix: 查询时空字符串问题

This commit is contained in:
猿小天
2023-07-12 21:34:57 +08:00
parent dcdc7bbe3b
commit 1ccfd619f3

View File

@@ -22,15 +22,19 @@ function createService() {
},
paramsSerializer: {
serialize(params) {
return qs.stringify(params, {
indices: false,
encoder: (val: string) => {
if (typeof val === 'boolean') {
return val ? 'True' : 'False';
}
return val;
},
});
interface paramsObj {
[key: string]: any;
}
let result:paramsObj = {};
for (const [key, value] of Object.entries(params)) {
if (value !== '') {
result[key] = value;
}
if(typeof value === 'boolean'){
result[key] = value? 'True': 'False';
}
}
return qs.stringify(result);
},
},
});