-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update ja docs #3214
fix: update ja docs #3214
Changes from 1 commit
f06a91f
9ff4d63
e8cd6d0
640ea21
9faaa19
7c8c69c
c49583a
df1cebc
3501917
69b641e
fe5de6d
a3e38b5
7ecd1e6
b932916
0298ab3
0d11706
8732eac
3d20b74
8c23d42
48d128f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,13 @@ router.beforeEach((to, from, next) => { | |
|
||
- **`next(error)`**: (2.4.0+) `next` に渡された引数が `Error` インスタンスである場合、ナビゲーションは中止され、エラーは `router.onError()` を介して登録されたコールバックに渡されます。 | ||
|
||
**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: | ||
**与えれれた任意のナビゲーションガードで、常に 1回だけ `next` 関数が呼び出されるようにしてください。それは複数回呼び出すことができますが、論理パスが重ならないときだけで、そうしないないとフックは決して解決されない、またはエラーが発生します。** 以下は、ユーザーが認証されていない場合、`/login` にリダレクトするための例です: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The original sentence tells "It can appear more than once" which means you can write There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, you're right ... 😅 |
||
|
||
```js | ||
// BAD | ||
router.beforeEach((to, from, next) => { | ||
if (!isAuthenticated) next('/login') | ||
// if the user is not authenticated, `next` is called twice | ||
// ユーザーが認証されていない場合、 `next` は2回呼ばれる | ||
next() | ||
}) | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.