Skip to content

useUserRole ​

User role checking composable.

Import ​

typescript
const { isAdmin, userRole, checkRole } = useUserRole()

Return Values ​

PropertyTypeDescription
isAdminComputedRef<boolean>Whether current user is admin
userRoleRef<string>Current user's role ('admin' or 'user')

Methods ​

MethodParametersReturnsDescription
checkRole—Promise<string>Refresh role from database

Source ​

app/composables/useUserRole.ts

Built with VitePress