refactor: 【web-ant】重构认证模块并移除未使用的组件和功能【0fed9472】(剩余 request、present)

This commit is contained in:
YunaiV
2025-03-26 07:36:12 +08:00
parent e65469b5ea
commit c881a47ffd
12 changed files with 80 additions and 13 deletions

View File

@@ -18,9 +18,10 @@ export function useAppConfig(
const { VITE_APP_CAPTCHA_ENABLE, VITE_APP_TENANT_ENABLE, VITE_GLOB_API_URL } =
config;
// TODO @芋艿:貌似 VITE_APP_CAPTCHA_ENABLE 读取的是字符串,所以这里暂时这么转换
return {
apiURL: VITE_GLOB_API_URL,
captchaEnable: VITE_APP_CAPTCHA_ENABLE,
tenantEnable: VITE_APP_TENANT_ENABLE,
captchaEnable: VITE_APP_CAPTCHA_ENABLE === 'true',
tenantEnable: VITE_APP_TENANT_ENABLE === 'true',
};
}

View File

@@ -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:"
}
}

View File

@@ -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);

View File

@@ -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,