From 17c33385daafc6c7746ab669c4225708216ead5f Mon Sep 17 00:00:00 2001 From: ovo Date: Sat, 7 Dec 2024 13:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 9176ec1..f985a02 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -34,15 +34,8 @@ service.interceptors.request.use( // 响应拦截器 service.interceptors.response.use( (response: AxiosResponse) => { - const { code, message, data } = response.data - - // 根据后端约定的状态码处理 - if (code === 200) { - return data - } else { - ElMessage.error(message || '请求失败') - return Promise.reject(new Error(message || '请求失败')) - } + // 直接返回整个响应数据,而不是只返回 data + return response.data }, (error) => { const { status } = error.response || {}