From d5e624ffc1c3a4c81be41fbf4f4f969a632c4c26 Mon Sep 17 00:00:00 2001 From: Lo <709937065@qq.com> Date: Thu, 14 Apr 2022 16:51:39 +0800 Subject: [PATCH] docs: fix clearError type and server route prefix (#4342) --- docs/content/2.guide/2.features/7.error-handling.md | 2 +- docs/content/2.guide/2.features/9.server-routes.md | 4 ++-- docs/content/3.api/3.utils/clear-error.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content/2.guide/2.features/7.error-handling.md b/docs/content/2.guide/2.features/7.error-handling.md index 90e519965..58fab57a7 100644 --- a/docs/content/2.guide/2.features/7.error-handling.md +++ b/docs/content/2.guide/2.features/7.error-handling.md @@ -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` +* `function clearError (options?: { redirect?: string }): Promise` 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). diff --git a/docs/content/2.guide/2.features/9.server-routes.md b/docs/content/2.guide/2.features/9.server-routes.md index 8c5d25c6a..1c246bd49 100644 --- a/docs/content/2.guide/2.features/9.server-routes.md +++ b/docs/content/2.guide/2.features/9.server-routes.md @@ -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 diff --git a/docs/content/3.api/3.utils/clear-error.md b/docs/content/3.api/3.utils/clear-error.md index 34a4a7a1d..e72c2e108 100644 --- a/docs/content/3.api/3.utils/clear-error.md +++ b/docs/content/3.api/3.utils/clear-error.md @@ -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.