Sfoglia il codice sorgente

refactor(http): 移除注释并添加TODO提示

移除冗余注释,简化错误处理逻辑。添加TODO提示以便后续处理不满足业务要求的情况。
feige996 6 mesi fa
parent
commit
ec012f41a1
1 ha cambiato i file con 1 aggiunte e 8 eliminazioni
  1. 1 8
      src/http/http.ts

+ 1 - 8
src/http/http.ts

@@ -100,15 +100,8 @@ export function http<T>(options: CustomRequestOptions) {
               icon: 'none',
               icon: 'none',
               title: responseData.msg || responseData.message || '请求错误',
               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)
           return resolve(responseData as T)
         }
         }