You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
803 B
TypeScript
26 lines
803 B
TypeScript
/**
|
|
* Once you are ready to add authentication to your application
|
|
* you'll build out requireAuth() with real functionality. For
|
|
* now we just return `true` so that the calls in services
|
|
* have something to check against, simulating a logged
|
|
* in user that is allowed to access that service.
|
|
*
|
|
* See https://redwoodjs.com/docs/authentication for more info.
|
|
*/
|
|
export const isAuthenticated = () => {
|
|
return true
|
|
}
|
|
|
|
export const hasRole = ({ roles }) => {
|
|
return roles !== undefined
|
|
}
|
|
|
|
// This is used by the redwood directive
|
|
// in ./api/src/directives/requireAuth
|
|
|
|
// Roles are passed in by the requireAuth directive if you have auth setup
|
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
export const requireAuth = ({ roles }) => {
|
|
return isAuthenticated()
|
|
}
|