mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
docs: fix clearError type and server route prefix (#4342)
This commit is contained in:
parent
32c798cfc4
commit
d5e624ffc1
@ -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).
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user