From ec012f41a1fa0c1152e634d6a3f2c0cf443ff8b1 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Tue, 21 Oct 2025 16:08:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(http):=20=E7=A7=BB=E9=99=A4=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E5=B9=B6=E6=B7=BB=E5=8A=A0TODO=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除冗余注释,简化错误处理逻辑。添加TODO提示以便后续处理不满足业务要求的情况。 --- src/http/http.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/http/http.ts b/src/http/http.ts index 29f48d0..851e2b0 100644 --- a/src/http/http.ts +++ b/src/http/http.ts @@ -100,15 +100,8 @@ export function http(options: CustomRequestOptions) { icon: 'none', title: responseData.msg || responseData.message || '请求错误', }) - //这里不直接抛出错误,会中断promise链条,无法进入finally,在下方return resolve(responseData as T)继续执行,在接口调用可通过判断code来处理业务逻辑 - //async getSampleEnums() { - // const res = await getSampleEnumsApi(); - // if (res.code === ResultEnum.Success200) { - // // 处理成功 - // } - //}, - //throw new Error(`请求错误[${code}]:${responseData.message || responseData.msg}`) } + // TODO: check 如果不满足业务要求,也可以改为 reject(responseData as T) return resolve(responseData as T) }