Skip to content

Commit

Permalink
feat: reqest query参数 删除null值
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Jan 9, 2023
1 parent 365e065 commit 26a989c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const t = (...args: [string | number]) => useGlobalStore().i18n.t(...args);
const service = axios.create({
baseURL: '/api/', // url = base url + request url
timeout: 10000, // request timeout
paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'repeat' }), // 数组query参数转换为repeat a=1&a=2
paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'repeat', skipNulls: true }), // 数组query参数转换为repeat a=1&a=2,null值会被删除
});
// 请求拦截器
service.interceptors.request.use(
Expand Down

0 comments on commit 26a989c

Please sign in to comment.