From 905a7b640b6f65751554df80a14313f6e367acf7 Mon Sep 17 00:00:00 2001 From: baiqi Date: Mon, 17 Jul 2023 16:47:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=B7=E6=B1=82=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/http/checkStatus.ts | 20 ++++++++++---------- frontend/src/api/http/index.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/src/api/http/checkStatus.ts b/frontend/src/api/http/checkStatus.ts index ff3d808a60..988580a3a7 100644 --- a/frontend/src/api/http/checkStatus.ts +++ b/frontend/src/api/http/checkStatus.ts @@ -17,35 +17,35 @@ export default function checkStatus(status: number, msg: string, errorMessageMod break; } case 403: - errMessage = t('api.errMsg403'); + errMessage = msg || t('api.errMsg403'); break; // 404请求不存在 case 404: - errMessage = t('api.errMsg404'); + errMessage = msg || t('api.errMsg404'); break; case 405: - errMessage = t('api.errMsg405'); + errMessage = msg || t('api.errMsg405'); break; case 408: - errMessage = t('api.errMsg408'); + errMessage = msg || t('api.errMsg408'); break; case 500: - errMessage = t('api.errMsg500'); + errMessage = msg || t('api.errMsg500'); break; case 501: - errMessage = t('api.errMsg501'); + errMessage = msg || t('api.errMsg501'); break; case 502: - errMessage = t('api.errMsg502'); + errMessage = msg || t('api.errMsg502'); break; case 503: - errMessage = t('api.errMsg503'); + errMessage = msg || t('api.errMsg503'); break; case 504: - errMessage = t('api.errMsg504'); + errMessage = msg || t('api.errMsg504'); break; case 505: - errMessage = t('api.errMsg505'); + errMessage = msg || t('api.errMsg505'); break; default: } diff --git a/frontend/src/api/http/index.ts b/frontend/src/api/http/index.ts index 0ba2f754c5..43a1339424 100644 --- a/frontend/src/api/http/index.ts +++ b/frontend/src/api/http/index.ts @@ -132,7 +132,7 @@ const transform: AxiosTransform = { const { t } = useI18n(); const { response, code, message, config } = error || {}; const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; - const msg: string = response?.data?.error?.message ?? ''; + const msg: string = response?.data?.message ?? ''; const err: string = error?.toString?.() ?? ''; let errMessage = '';