Skip to content

DoCurious API Reference / store / selectHasRole

Function: selectHasRole()

selectHasRole(role): (state) => boolean

Defined in: store/useAuthStore.ts:484

Create a selector that checks if the user has a specific role.

Parameters

role

UserRole

The role to check against

Returns

Selector function returning true if the user's role matches

(state): boolean

Parameters

state

AuthStore

Returns

boolean

Example

ts
const isTeacher = useAuthStore(selectHasRole('teacher'))

DoCurious Platform Documentation