Skip to content

DoCurious API Reference / store / selectHasAnyRole

Function: selectHasAnyRole()

selectHasAnyRole(roles): (state) => boolean

Defined in: store/useAuthStore.ts:498

Create a selector that checks if the user has any of the specified roles.

Parameters

roles

UserRole[]

Array of roles to match against

Returns

Selector function returning true if the user's role is in the list

(state): boolean

Parameters

state

AuthStore

Returns

boolean

Example

ts
const canManageSchool = useAuthStore(selectHasAnyRole(['school_admin', 'head_school_admin']))

DoCurious Platform Documentation