Skip to content

Commit

Permalink
Update router.md
Browse files Browse the repository at this point in the history
Private Set reference should include useAuth={useAuth} on the router.
  • Loading branch information
jonvaljonathan authored Dec 9, 2024
1 parent 6ee583f commit 9e3f662
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/docs/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ A `PrivateSet` makes all Routes inside that Set require authentication. When a u
Here's an example of how you'd use a `PrivateSet`:

```jsx title="Routes.jsx"
<Router>
<Router useAuth={useAuth}>
<Route path="/" page={HomePage} name="home" />
<PrivateSet unauthenticated="home">
<Route path="/admin" page={AdminPage} name="admin" />
Expand All @@ -178,7 +178,7 @@ For more fine-grained control, you can specify `roles` (which takes a string for
To protect private routes for access by a single role:

```jsx title="Routes.jsx"
<Router>
<Router useAuth={useAuth}>
<PrivateSet unauthenticated="forbidden" roles="admin">
<Route path="/admin/users" page={UsersPage} name="users" />
</PrivateSet>
Expand All @@ -190,7 +190,7 @@ To protect private routes for access by a single role:
To protect private routes for access by multiple roles:

```jsx title="Routes.jsx"
<Router>
<Router useAuth={useAuth}>
<PrivateSet unauthenticated="forbidden" roles={['admin', 'editor', 'publisher']}>
<Route path="/admin/posts/{id:Int}/edit" page={EditPostPage} name="editPost" />
</PrivateSet>
Expand Down

0 comments on commit 9e3f662

Please sign in to comment.