提交 df9ec7c8 authored 作者: 钟是志's avatar 钟是志

接口参数过滤掉 空字符串和 undefined

上级 06c1d0ac
......@@ -22,6 +22,7 @@ import { proxyChangeUrl } from '@/webPublic/zyd_public/request/proxyChangeUrl';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
import { getVisitorToken } from '@/webPublic/zyd_public/utils/getHeaders';
import { getCacheData, saveCacheData } from '@/webPublic/one_stop_public/utils/apiServiceCache';
import { filterSearchParams } from "@/webPublic/one_stop_public/utils/utils";
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -147,6 +148,7 @@ const requestA = (url, data, options = {}) => {
};
export async function request(url, data, options = {}) {
data = filterSearchParams(data);
if (localStorage.getItem('errDetail') === '1') { // 调试模式关闭加密
window.CONFIG.IS_SAFE = false;
window.CONFIG.IS_BINARY = false;
......
......@@ -82,7 +82,15 @@ export const getOneStopMyInfo = (params = {}) => {
}
});
}
};
export function filterSearchParams(data) {
if(data && typeof data === 'object'){
for(let key in data){
if(data[key] === '' || typeof data[key] === 'undefined'){
delete data[key];
}
}
}
return data;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论