Composables
useXAdminUsers
Provides admin actions for user management including role updates, suspension, password reset, and hard or soft deletion.
useXAdminUsers
User management composable. Wraps the /api/admin/users/* endpoints with typed async actions for role assignment, suspension, password resets, and deletion. Pairs with XAdminUsersDirectory for the list view and XAdminUsersDetail for per-user actions.
Usage
const admin = useXAdminUsers()
await admin.updateRole(userId, "editor")
await admin.suspendUser(userId, "Violation of TOS")
await admin.unsuspendUser(userId)
await admin.resetPassword(userId)
await admin.deleteUser(userId, { hardDelete: false })
Returns
| Key | Type | Description |
|---|---|---|
updateRole | (userId: string, role: string) => Promise<void> | Assigns a new role to the specified user. |
suspendUser | (userId: string, reason: string) => Promise<void> | Suspends a user account with an optional reason. |
unsuspendUser | (userId: string) => Promise<void> | Lifts a suspension and restores user access. |
resetPassword | (userId: string) => Promise<void> | Triggers a password-reset flow for the user. |
deleteUser | (userId: string, opts?: { hardDelete: boolean }) => Promise<void> | Soft- or hard-deletes a user account. |
AI Context
composable: useXAdminUsers
package: "@xenterprises/nuxt-x-app-admin"
use-when: >
Performing admin-level user actions — changing roles, suspending or unsuspending
accounts, forcing password resets, or deleting users. Uses Better Auth endpoints
under /api/admin/users/*.
pairs-with: XAdminUsersDirectory, XAdminUsersDetail, XAdminUsersProfile, XAdminUsersSessions
useXAdminImpersonation
Starts and stops admin impersonation sessions and exposes reactive state for the current impersonated user.
useXAdminStripe
Provides reactive Stripe customer and subscription state plus admin actions for syncing customers, cancelling subscriptions, and refunding or voiding invoices.
