From b5ec67a66681def1ccddea9b6014b2b7aea73820 Mon Sep 17 00:00:00 2001 From: winixt Date: Wed, 14 Jun 2023 15:08:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20request=20=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-request/src/template/request.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/fes-plugin-request/src/template/request.js b/packages/fes-plugin-request/src/template/request.js index c98683ad..214173c2 100644 --- a/packages/fes-plugin-request/src/template/request.js +++ b/packages/fes-plugin-request/src/template/request.js @@ -15,7 +15,7 @@ function getRequestInstance() { return createRequest(defaultConfig); } -const currentRequest = getRequestInstance(); +let currentRequest; export const rawRequest = (url, data, options = {}) => { if (typeof options === 'string') { @@ -23,6 +23,9 @@ export const rawRequest = (url, data, options = {}) => { method: options, }; } + if (!currentRequest) { + currentRequest = getRequestInstance(); + } return currentRequest(url, data, options); };