Ver código fonte

refactor: 删除httpPostOriginal方法,通过options设置

panda 4 meses atrás
pai
commit
319942dc39
3 arquivos alterados com 4 adições e 18 exclusões
  1. 2 2
      src/api/login.ts
  2. 0 16
      src/http/http.ts
  3. 2 0
      src/http/types.ts

+ 2 - 2
src/api/login.ts

@@ -70,7 +70,7 @@ export interface AuthResetPasswordReqVO {
  * @returns ICaptcha 验证码
  */
 export function getCode(data: any) {
-  return http.postOriginal<ICaptcha>('/system/captcha/get', data)
+  return http.post<ICaptcha>('/system/captcha/get', data, null, null, { original: true })
 }
 
 /**
@@ -79,7 +79,7 @@ export function getCode(data: any) {
  * @returns Promise 包含校验结果
  */
 export function checkCaptcha(data: any) {
-  return http.postOriginal('/system/captcha/check', data)
+  return http.post<boolean>('/system/captcha/check', data, null, null, { original: true })
 }
 
 /** 使用账号密码登录 */

+ 0 - 16
src/http/http.ts

@@ -200,24 +200,8 @@ export function httpDelete<T>(url: string, query?: Record<string, any>, header?:
   })
 }
 
-/**
- * POST 请求(返回原始数据)
- */
-export function httpPostOriginal<T>(url: string, data?: Record<string, any>, query?: Record<string, any>, header?: Record<string, any>, options?: Partial<CustomRequestOptions>) {
-  return http<T>({
-    url,
-    data,
-    query,
-    method: 'POST',
-    header,
-    original: true,
-    ...options,
-  })
-}
-
 // 支持与 axios 类似的API调用
 http.get = httpGet
 http.post = httpPost
 http.put = httpPut
 http.delete = httpDelete
-http.postOriginal = httpPostOriginal

+ 2 - 0
src/http/types.ts

@@ -34,3 +34,5 @@ export interface PageResult<T> {
   list: T[]
   total: number
 }
+/** 加载状态枚举 - 从 wot-design-uni 重新导出 */
+export type { LoadMoreState } from 'wot-design-uni/components/wd-loadmore/types'