Skip to content

Commit

Permalink
Add default getCurrentUser to api/src/lib/auth (#9810)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jan 17, 2024
1 parent 480f00c commit 4c9bda1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/create-redwood-app/templates/js/api/src/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ export const hasRole = ({ roles }) => {
export const requireAuth = ({ roles }) => {
return isAuthenticated()
}

export const getCurrentUser = async () => {
throw new Error(
'Auth is not set up yet. See https://redwoodjs.com/docs/authentication ' +
'to get started'
)
}
7 changes: 7 additions & 0 deletions packages/create-redwood-app/templates/ts/api/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ export const hasRole = ({ roles }) => {
export const requireAuth = ({ roles }) => {
return isAuthenticated()
}

export const getCurrentUser = async () => {
throw new Error(
'Auth is not set up yet. See https://redwoodjs.com/docs/authentication ' +
'to get started'
)
}

0 comments on commit 4c9bda1

Please sign in to comment.