Skip to content

Commit

Permalink
docs: reorder example
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Aug 2, 2023
1 parent e4c0a54 commit 98e9af6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build.environment]
CHROMEDRIVER_SKIP_DOWNLOAD = "true"
NODE_VERSION = "18"

[build]
command = "pnpm run docs:build"
Expand Down
8 changes: 8 additions & 0 deletions packages/docs/api/interfaces/Router.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ function that removes the registered hook.

`fn`

a function that removes the registered hook

▸ (): `void`

Add a navigation hook that is executed after every navigation. Returns a
Expand All @@ -109,6 +111,8 @@ function that removes the registered hook.

`void`

a function that removes the registered hook

**`Example`**

```js
Expand Down Expand Up @@ -191,6 +195,8 @@ registered guard.

`fn`

a function that removes the registered guard

▸ (): `void`

Add a navigation guard that executes before navigation is about to be
Expand All @@ -202,6 +208,8 @@ registered guard.

`void`

a function that removes the registered guard

**`Example`**

```js
Expand Down
5 changes: 3 additions & 2 deletions packages/router/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export function createRouterError<E extends RouterError>(
/**
* Check if an object is a {@link NavigationFailure}.
*
* @param error - possible {@link NavigationFailure}
* @param type - optional types to check for
*
* @example
* ```js
* import { isNavigationFailure, NavigationFailureType } from 'vue-router'
Expand All @@ -163,8 +166,6 @@ export function createRouterError<E extends RouterError>(
* }
* })
* ```
* @param error - possible {@link NavigationFailure}
* @param type - optional types to check for
*/
export function isNavigationFailure(
error: any,
Expand Down
10 changes: 7 additions & 3 deletions packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,26 @@ export interface Router {
* navigation guards have been successful. Returns a function that removes the
* registered guard.
*
* @param guard - navigation guard to add
* @returns a function that removes the registered guard
*
* @example
* ```js
* router.beforeResolve(to => {
* if (to.meta.requiresAuth && !isAuthenticated) return false
* })
* ```
*
* @param guard - navigation guard to add
*/
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void

/**
* Add a navigation hook that is executed after every navigation. Returns a
* function that removes the registered hook.
*
* @param guard - navigation hook to add
* @returns a function that removes the registered hook
*
* @example
* ```js
* router.afterEach((to, from, failure) => {
Expand All @@ -309,8 +315,6 @@ export interface Router {
* }
* })
* ```
*
* @param guard - navigation hook to add
*/
afterEach(guard: NavigationHookAfter): () => void

Expand Down

0 comments on commit 98e9af6

Please sign in to comment.