Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Latest commit

 

History

History
129 lines (83 loc) · 3.72 KB

fetch.md

File metadata and controls

129 lines (83 loc) · 3.72 KB

isomorphic-json-fetch / fetch

Namespace: fetch

Table of contents

Variables

Functions

Variables

post

post: typeof fetch

Functions

delete

delete<JsonType, ErrorType>(url: string, config?: FetchConfig): Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Syntactic sugar for calling fetch(..., { method: 'DELETE', ... }).

Type parameters:

Name Type Default
JsonType SerializedValue Record<string, unknown>
ErrorType SerializedValue JsonType

Parameters:

Name Type
url string
config? FetchConfig

Returns: Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Defined in: src/index.ts:161


get

get<JsonType, ErrorType>(url: string, config?: FetchConfig): Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Syntactic sugar for calling fetch(..., { method: 'GET', ... }).

Type parameters:

Name Type Default
JsonType SerializedValue Record<string, unknown>
ErrorType SerializedValue JsonType

Parameters:

Name Type
url string
config? FetchConfig

Returns: Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Defined in: src/index.ts:139


put

put<JsonType, ErrorType>(url: string, config?: FetchConfig): Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Syntactic sugar for calling fetch(..., { method: 'PUT', ... }).

Type parameters:

Name Type Default
JsonType SerializedValue Record<string, unknown>
ErrorType SerializedValue JsonType

Parameters:

Name Type
url string
config? FetchConfig

Returns: Promise<{ error: undefined | ErrorType ; json: undefined | JsonType ; res: Response }>

Defined in: src/index.ts:150


swr

swr(key: string): Promise<Record<string, unknown>>

Parameters:

Name Type
key string

Returns: Promise<Record<string, unknown>>

Defined in: src/index.ts:177