Skip to content

Commit

Permalink
Update rbac.md - code match (#10405)
Browse files Browse the repository at this point in the history
code in repo was different from code in tutorial and it was missing the
if statement. i added it in to reduce confusion for a new person who
might get confused by the difference.

tutorial code: 
![Screen Shot 2024-04-03 at 12 06 55
PM](https://github.com/redwoodjs/redwood/assets/2617706/4847d98a-5ed4-4e51-9cb6-ef6e91cac432)


repo code: 
![Screen Shot 2024-04-03 at 12 07 34
PM](https://github.com/redwoodjs/redwood/assets/2617706/210655e5-4ac5-434c-a08f-1a158566d3d9)
  • Loading branch information
JamesHighsmith authored and jtoar committed Apr 10, 2024
1 parent a15cdaf commit 6bc1835
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/docs/tutorial/chapter7/rbac.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Before we do that, we'll need to make sure that the web side has access to the r
```javascript title="api/src/lib/auth.js"
export const getCurrentUser = async (session) => {
if (!session || typeof session.id !== 'number') {
throw new Error('Invalid session')
}

return await db.user.findUnique({
where: { id: session.id },
// highlight-next-line
Expand Down

0 comments on commit 6bc1835

Please sign in to comment.