Compare commits

...

5 Commits

Author SHA1 Message Date
winixt
831a91bded chore: v3.4.11 2025-03-14 18:22:38 +08:00
winixt
2cb7d5d4e0 fix: request 属性代理问题 2025-03-14 18:21:48 +08:00
winixt
677a25d00d chore: v3.4.10 2025-03-14 18:04:33 +08:00
winixt
4f07de0df0 chore: update lock 2025-03-14 18:04:06 +08:00
winixt
6649e0615b fix: 修复 request 属性挂载问题 2025-03-14 17:57:30 +08:00
5 changed files with 37 additions and 13 deletions

View File

@ -1,3 +1,21 @@
## [3.4.11](https://github.com/WeBankFinTech/fes.js/compare/v3.4.10...v3.4.11) (2025-03-14)
### Bug Fixes
* request 属性代理问题 ([2cb7d5d](https://github.com/WeBankFinTech/fes.js/commit/2cb7d5d4e0bf53ffd89fa8dd1b51266499642fac))
## [3.4.10](https://github.com/WeBankFinTech/fes.js/compare/v3.4.9...v3.4.10) (2025-03-14)
### Bug Fixes
* 修复 request 属性挂载问题 ([6649e06](https://github.com/WeBankFinTech/fes.js/commit/6649e0615b5141fe8fccfeaa0565b961ba360fde))
## [3.4.9](https://github.com/WeBankFinTech/fes.js/compare/v3.4.8...v3.4.9) (2025-03-10)

View File

@ -1,7 +1,7 @@
{
"name": "fes.js",
"type": "module",
"version": "3.4.9",
"version": "3.4.11",
"private": true,
"packageManager": "pnpm@8.6.6",
"description": "一个好用的前端管理台快速开发框架",

View File

@ -1,6 +1,6 @@
{
"name": "@fesjs/plugin-request",
"version": "4.0.0-rc.7",
"version": "4.0.1",
"description": "@fesjs/plugin-request",
"author": "qlin",
"license": "MIT",
@ -33,7 +33,7 @@
},
"dependencies": {
"@fesjs/utils": "^3.0.3",
"@qlin/request": "^0.3.0"
"@qlin/request": "^0.3.1"
},
"typings": "./types.d.ts"
}

View File

@ -15,20 +15,26 @@ function getRequestInstance() {
return createRequest(defaultConfig);
}
// 不能立马初始化,用户配置可能还没准备好
let currentRequest;
export function rawRequest(url, data, options = {}) {
if (typeof options === 'string') {
options = {
method: options,
};
}
function _rawRequest(url, data, options = {}) {
if (!currentRequest) {
currentRequest = getRequestInstance();
}
return currentRequest(url, data, options);
}
// 代理 request 上的属性
export const rawRequest = new Proxy(_rawRequest, {
get(_, key) {
if (!currentRequest) {
currentRequest = getRequestInstance();
}
return currentRequest[key];
},
});
export async function request(url, data, options = {}) {
const response = await rawRequest(url, data, options);
return response.data;

8
pnpm-lock.yaml generated
View File

@ -650,8 +650,8 @@ importers:
specifier: ^3.0.3
version: link:../fes-utils
'@qlin/request':
specifier: ^0.3.0
version: 0.3.0
specifier: ^0.3.1
version: 0.3.1
vue:
specifier: ^3.2.37
version: 3.3.4
@ -4777,8 +4777,8 @@ packages:
resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==}
dev: false
/@qlin/request@0.3.0:
resolution: {integrity: sha512-/1bvNA1BPjxXrFONbBvq+e/+uJKgvKjZs9YhQ97NABAXGNOaqMXsRS6MEfDIRZok4lbkHRquCXON2Lht3CkD6A==}
/@qlin/request@0.3.1:
resolution: {integrity: sha512-/oTvZ+zPwNN0Zdv/MiP9AHcgajEkMElZ1568TOKRe3H4Wv8RjjwVAp/0as7eiNc8pdegK2Vj2nNbL09JUhsvOQ==}
dependencies:
lodash-es: 4.17.21
dev: false