docs: fix clearError type and server route prefix (#4342)

This commit is contained in:
Lo 2022-04-14 16:51:39 +08:00 committed by GitHub
parent 32c798cfc4
commit d5e624ffc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -91,7 +91,7 @@ You can call this function at any point on client-side, or (on server side) dire
### `clearError`
* `function clearError (redirect?: string): Promise<void>`
* `function clearError (options?: { redirect?: string }): Promise<void>`
This function will clear the currently handled Nuxt error. It also takes an optional path to redirect to (for example, if you want to navigate to a 'safe' page).

View File

@ -21,7 +21,7 @@ export default defineEventHandler((event) => {
})
```
You can now universally call this API using `await $fetch('/API/hello')`.
You can now universally call this API using `await $fetch('/api/hello')`.
## Server Routes
@ -70,7 +70,7 @@ Server routes can use dynamic parameters within brackets in the file name like `
export default defineEventHandler(event => `Hello, ${event.context.params.name}!`)
```
You can now universally call this API using `await $fetch('/API/hello/nuxt')` and get `Hello, nuxt!`.
You can now universally call this API using `await $fetch('/api/hello/nuxt')` and get `Hello, nuxt!`.
## Matching HTTP Method

View File

@ -6,7 +6,7 @@ Within your pages, components, and plugins, you can use `clearError` to clear al
**Parameters:**
- `redirect` (optional): `string`
- `options?: { redirect?: string }`
You can provide an optional path to redirect to (for example, if you want to navigate to a 'safe' page).
@ -15,7 +15,7 @@ You can provide an optional path to redirect to (for example, if you want to nav
clearError()
// With redirect
clearError('/homepage')
clearError({ redirect: '/homepage' })
```
Errors are set in state using [`useError()`](/api/composables/useError). The `clearError` composable will reset this state and calls the `app:error:cleared` hook with the provided options.