Skip to content

Commit

Permalink
docs: improve wording on next callback
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Oct 9, 2019
1 parent e014630 commit 23d87d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/guide/advanced/navigation-guards.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Every guard function receives three arguments:

- **`next(error)`**: (2.4.0+) if the argument passed to `next` is an instance of `Error`, the navigation will be aborted and the error will be passed to callbacks registered via [`router.onError()`](../../api/#router-onerror).

This comment has been minimized.

Copy link
@afwn90cj93201nixr2e1re

afwn90cj93201nixr2e1re Oct 14, 2019

You should add callback for next(false);
#2956 (comment)


**Make sure that the `next` function is called exactly once in any given navigation guard. It can appear more than once, but only if the logical paths have no overlap, otherwise the hook will never be resolved or produce errors.** Here is an example of redirecting to user to `/login` if they are not authenticated:
**Make sure that the `next` function is called exactly once in any given pass through the navigation guard. It can appear more than once, but only if the logical paths have no overlap, otherwise the hook will never be resolved or produce errors.** Here is an example of redirecting to user to `/login` if they are not authenticated:

```js
// BAD
Expand Down

0 comments on commit 23d87d8

Please sign in to comment.