Commit 33df7ad3 authored by 前端-许佳敏's avatar 前端-许佳敏

get请求支持对象传输

parent 45c937c1
...@@ -5,6 +5,7 @@ import { history } from 'umi' ...@@ -5,6 +5,7 @@ import { history } from 'umi'
import { message } from 'antd' import { message } from 'antd'
import { getAuth, removeAuth } from './auth'; import { getAuth, removeAuth } from './auth';
import { GlobalConfig } from '@/global/config'; import { GlobalConfig } from '@/global/config';
import qs from 'qs'
export type CtlType = 'none' | 'message' export type CtlType = 'none' | 'message'
// 根前缀请求路径 // 根前缀请求路径
...@@ -77,6 +78,9 @@ baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit): ...@@ -77,6 +78,9 @@ baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit):
memberId, memberId,
token token
} }
options.paramsSerializer = params => {
return qs.stringify(params, { arrayFormat: 'brackets' })
}
return { return {
// 前缀如果已经带上api, 跳过自动补前缀 // 前缀如果已经带上api, 跳过自动补前缀
url: url.startsWith('/api') ? url : basePrefix + url, url: url.startsWith('/api') ? url : basePrefix + url,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment