From d3b53b766b6c721264ee82cbb69ad801e9d545e5 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 31 May 2024 16:59:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fetchJSON=20=E5=8E=BB=E9=99=A4=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA=E7=BB=93=E5=B0=BE=E7=9A=84&?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index f536a02..461bfed 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -49,8 +49,9 @@ export function fetchText(url) { export function fetchJSON(url, data) { const params = data ? new URLSearchParams(data).toString() : ''; const ifp = url.includes('?') ? '&' : '?'; - const headerObj = getRequestHeader() - return fetch(`${url}${ifp}${params}`, { + const headerObj = getRequestHeader(); + const fUrl = params !== '' ? `${fUrl}${ifp}${params}` : url; + return fetch(fUrl, { method: 'GET', headers: { 'X-Web-Version': BUILD_VERSION,