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: { paramsSerializer: {
serialize(params) { serialize(params) {
return qs.stringify(params, { interface paramsObj {
indices: false, [key: string]: any;
encoder: (val: string) => {
if (typeof val === 'boolean') {
return val ? 'True' : 'False';
} }
return val; 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);
}, },
}, },
}); });