From c0a5eba8f336b6de12e729463dc53cc0e66b65b2 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 18 Sep 2023 21:04:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0204?= =?UTF-8?q?=E6=97=A0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/http-fetch.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/http-fetch.ts b/src/plugins/http-fetch.ts index f95135c9..a0f961fd 100644 --- a/src/plugins/http-fetch.ts +++ b/src/plugins/http-fetch.ts @@ -300,18 +300,28 @@ export async function request(options: OptionsType): Promise { * @returns */ function stateCode(res: Response) { + // 网络异常 if (res.status === 500) { return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_SERVER_ERROR, }; } + // 上传文件成功无内容返回 + if (res.status === 204 && res.statusText === 'No Content') { + return { + code: RESULT_CODE_SUCCESS, + msg: RESULT_MSG_SUCCESS, + }; + } + // 地址找不到 if (res.status === 404) { return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_URL_NOTFOUND, }; } + // 身份授权 if (res.status === 401) { removeToken(); window.location.reload();