refactor: 【web-ant】重构认证模块并移除未使用的组件和功能【0fed9472】(剩余 request、present)
This commit is contained in:
@@ -22,9 +22,11 @@
|
||||
"dependencies": {
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"axios": "catalog:"
|
||||
"axios": "catalog:",
|
||||
"qs": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios-mock-adapter": "catalog:"
|
||||
"axios-mock-adapter": "catalog:",
|
||||
"@types/qs": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { RequestClientConfig, RequestClientOptions } from './types';
|
||||
import { bindMethods, merge } from '@vben/utils';
|
||||
|
||||
import axios from 'axios';
|
||||
import qs from 'qs';
|
||||
|
||||
import { FileDownloader } from './modules/downloader';
|
||||
import { InterceptorManager } from './modules/interceptor';
|
||||
@@ -36,6 +37,10 @@ class RequestClient {
|
||||
responseReturn: 'raw',
|
||||
// 默认超时时间
|
||||
timeout: 10_000,
|
||||
// 处理请求参数 默认使用 qs 库处理
|
||||
paramsSerializer: (params) => {
|
||||
return qs.stringify(params, { arrayFormat: 'repeat' });
|
||||
},
|
||||
};
|
||||
const { ...axiosConfig } = options;
|
||||
const requestConfig = merge(axiosConfig, defaultConfig);
|
||||
|
||||
@@ -52,12 +52,25 @@ interface HttpResponse<T = any> {
|
||||
*/
|
||||
code: number;
|
||||
data: T;
|
||||
message: string;
|
||||
msg: string;
|
||||
}
|
||||
|
||||
interface PageParam {
|
||||
[key: string]: any;
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
interface PageResult<T> {
|
||||
list: T[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export type {
|
||||
HttpResponse,
|
||||
MakeErrorMessageFn,
|
||||
PageParam,
|
||||
PageResult,
|
||||
RequestClientConfig,
|
||||
RequestClientOptions,
|
||||
RequestContentType,
|
||||
|
||||
Reference in New Issue
Block a user