Skip to content

@vtj


@vtj / utils / Request

Class: Request

Defined in: packages/utils/src/request.ts:154

Extended by

Constructors

new Request()

new Request(options): Request

Defined in: packages/utils/src/request.ts:162

Parameters

options

IRequestOptions = {}

Returns

Request

Properties

axios

axios: AxiosInstance

Defined in: packages/utils/src/request.ts:155


isLoading

isLoading: boolean = false

Defined in: packages/utils/src/request.ts:158


records

records: Record<string, IRequestRecord> = {}

Defined in: packages/utils/src/request.ts:157


settings

settings: IRequestSettings

Defined in: packages/utils/src/request.ts:156

Methods

cancel()

cancel(id?, message?): void

Defined in: packages/utils/src/request.ts:197

Parameters

id?

string

message?

string = '请求已取消'

Returns

void


send()

send<R, D>(options, isSkipWarn): Promise<R>

Defined in: packages/utils/src/request.ts:359

Type Parameters

R = any

D = any

Parameters

options

IRequestConfig<D> = {}

isSkipWarn

boolean = false

Returns

Promise<R>


setConfig()

setConfig(options): void

Defined in: packages/utils/src/request.ts:187

Parameters

options

IRequestOptions = {}

Returns

void


useRequest()

useRequest(onFulfilled?, onRejected?): () => void

Defined in: packages/utils/src/request.ts:424

Parameters

onFulfilled?

null | (value) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>

onRejected?

null | (error) => any

Returns

Function

Returns

void


useResponse()

useResponse(onFulfilled?, onRejected?): () => void

Defined in: packages/utils/src/request.ts:413

Parameters

onFulfilled?

null | (value) => AxiosResponse | Promise<AxiosResponse>

onRejected?

null | (error) => any

Returns

Function

Returns

void

Released under the MIT License.