useUserRole
User role checking composable.
Import
typescript
const { isAdmin, userRole, checkRole } = useUserRole()Return Values
| Property | Type | Description |
|---|---|---|
isAdmin | ComputedRef<boolean> | Whether current user is admin |
userRole | Ref<string> | Current user's role ('admin' or 'user') |
Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
checkRole | — | Promise<string> | Refresh role from database |
Source
app/composables/useUserRole.ts