Home > @dinofe/xt-core > XApisauceInstance

# XApisauceInstance interface

HTTP 实例

Signature:

export interface XApisauceInstance extends Omit<ApisauceInstance, 'any' | 'get' | 'delete' | 'head' | 'post' | 'put' | 'patch' | 'link' | 'unlink'> 

Extends: Omit<ApisauceInstance, 'any' | 'get' | 'delete' | 'head' | 'post' | 'put' | 'patch' | 'link' | 'unlink'>

# Remarks

  1. 业务参数校验的transform修改了ApiResponse的属性,类型变成了XApiResponse 'any' | 'get' | 'delete' | 'head' | 'post' | 'put' | 'patch' | 'link' | 'unlink'这些方法类型定义需要重写

  2. 示例对象post等方法的axiosConfig对象可覆盖创建示例对象时的config(除 'url' | 'method' | 'data' 之外)

# Properties

Property Modifiers Type Description
any <T, U = T>(config: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> TODO: 未知
delete <T, U = T>(url: string, params?: {}, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送DELETE请求
get <T, U = T>(url: string, params?: {}, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送GET请求
head <T, U = T>(url: string, params?: {}, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送HEAD请求
link <T, U = T>(url: string, params?: {}, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送LINK请求
patch <T, U = T>(url: string, data?: any, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送PATCH请求
post <T, U = T>(url: string, data?: any, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送POST请求
put <T, U = T>(url: string, data?: any, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送PUT请求
unlink <T, U = T>(url: string, params?: {}, axiosConfig?: CustomAxiosRequestConfig) => Promise<XApiResponse<T, U>> 发送UNLINK请求