Skip to content

Commit

Permalink
docs(useFetch): fix spelling errors. Closes vitest-dev#378 (vitest-de…
Browse files Browse the repository at this point in the history
  • Loading branch information
wheatjs committed Mar 14, 2021
1 parent b026b4c commit bfb4083
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/core/useFetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ they are fired, automatically refetch requests when the url changes, and create
## Usage

### Basic Usage
The `useFetch` funciton can be used by simply providing a url. The url can be either a string or a `ref`. The `data`
The `useFetch` function can be used by simply providing a url. The url can be either a string or a `ref`. The `data`
object will contain the result of the request, the `error` object will contain any errors, and the `isFetching` object will
indicate if the request is loading.
```ts
Expand Down Expand Up @@ -73,7 +73,7 @@ const { data } = useFetch(url, {
```

### Setting the request method and return type
The requset method and return type can be set by adding the appropite methods to the end of `useFetch`
The request method and return type can be set by adding the appropriate methods to the end of `useFetch`

```ts
// Request will be sent with GET method and data will be parsed as JSON
Expand All @@ -89,8 +89,8 @@ const { data } = useFetch(url, { method: 'GET' }, { refetch: true }).blob()
```

### Creating a custom instance
The `createFetch` function will return a useFetch function with whatever preconfigured options that are provided to it.
This is useful for interacting with API's thoughout an application that uses the same base URL or needs Authorization headers.
The `createFetch` function will return a useFetch function with whatever pre-configured options that are provided to it.
This is useful for interacting with API's throughout an application that uses the same base URL or needs Authorization headers.
```ts
const useMyFetch = createFetch({
baseUrl: 'https://my-api.com',
Expand Down
6 changes: 3 additions & 3 deletions packages/core/useFetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface UseFetchReturnBase<T> {
response: Ref<Response | null>

/**
* Any fetch errors that may have occured
* Any fetch errors that may have occurred
*/
error: Ref<any>

Expand Down Expand Up @@ -81,12 +81,12 @@ export interface BeforeFetchContext {
url: string

/**
* The requset options of the current request
* The request options of the current request
*/
options: RequestInit

/**
* Cancels the current requset
* Cancels the current request
*/
cancel: Fn
}
Expand Down

0 comments on commit bfb4083

Please sign in to comment.