mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
get查询参数序列化 无效问题修复
Signed-off-by: Mac666 <support@mail.pigx.vip>
This commit is contained in:
parent
080bbbed27
commit
34de3fced6
@ -10,6 +10,9 @@ import other from './other';
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
timeout: 50000, // 全局超时时间
|
||||
paramsSerializer: (params: any) => {
|
||||
return qs.stringify(params, { arrayFormat: 'repeat' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@ -21,14 +24,6 @@ const service: AxiosInstance = axios.create({
|
||||
*/
|
||||
service.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
// 对get请求参数进行序列化
|
||||
if (config.method === 'get') {
|
||||
// @ts-ignore 使用qs库来序列化查询参数
|
||||
config.paramsSerializer = (params: any) => {
|
||||
return qs.stringify(params, { arrayFormat: 'repeat' });
|
||||
};
|
||||
}
|
||||
|
||||
// 统一增加Authorization请求头, skipToken 跳过增加token
|
||||
const token = Session.getToken();
|
||||
if (token && !config.headers?.skipToken) {
|
||||
|
Loading…
Reference in New Issue
Block a user