feat(projects): @sa/axios: add qs stringify for params

This commit is contained in:
Soybean
2024-01-23 00:30:43 +08:00
parent b3779a6313
commit 2400c02655
3 changed files with 28 additions and 14 deletions

View File

@ -1,5 +1,6 @@
import type { CreateAxiosDefaults } from 'axios';
import type { IAxiosRetryConfig } from 'axios-retry';
import { stringify } from 'qs';
import { isHttpSuccess } from './shared';
import type { RequestOption } from './type';
@ -35,7 +36,10 @@ export function createAxiosConfig(config?: Partial<CreateAxiosDefaults>) {
headers: {
'Content-Type': 'application/json'
},
validateStatus: isHttpSuccess
validateStatus: isHttpSuccess,
paramsSerializer: params => {
return stringify(params);
}
};
Object.assign(axiosConfig, config);