X Enterprises
Composables

useXUsers

Composable for fetching and managing users — listing, inviting, and updating roles via the fastify-xadmin API.

useXUsers

useXUsers provides reactive state and async actions for managing users in admin panels. It handles fetching the user list, sending invitations, and updating user roles through the @xenterprises/fastify-xadmin backend.

Usage

const { users, loading, fetchUsers, inviteUser, updateRole } = useXUsers()

Returns

KeyTypeDescription
usersRef<User[]>Reactive list of all users returned from the API
loadingRef<boolean>true while any async operation is in flight
fetchUsers() => Promise<void>Fetch (or refresh) the full user list from the backend
inviteUser(email: string, role?: string) => Promise<void>Send an email invitation to a new user, optionally assigning an initial role
updateRole(userId: string, role: string) => Promise<void>Update the role for an existing user by their ID

AI Context

composable: useXUsers
package: "@xenterprises/nuxt-x-users"
use-when: Fetching and managing users programmatically (listing, inviting, changing roles)
Copyright © 2026