X Enterprises
Composables

useXAdminDashboard

Fetches and reactively manages dashboard metrics, charts, active users, revenue history, and system health data with optional auto-refresh.

useXAdminDashboard

Dashboard data composable. Calls the /api/admin/dashboard/* endpoints to populate metrics, charts, system health, and real-time active user counts. Accepts an optional options object to configure a polling interval so the dashboard stays live without manual refresh.

Usage

const dashboard = useXAdminDashboard({ refreshInterval: 30000 })

dashboard.health.value
dashboard.metrics.value
dashboard.activeUsers.value
dashboard.revenueHistory.value

await dashboard.refreshAll()

Returns

KeyTypeDescription
healthRef<SystemHealth>Current system health status (CPU, memory, disk, services).
metricsRef<DashboardMetrics>Configurable metrics grid data (totals, deltas, trends).
activeUsersRef<number>Real-time count of active users.
revenueHistoryRef<RevenuePoint[]>Time-series revenue data for the area chart.
refreshAll() => Promise<void>Re-fetches all dashboard endpoints simultaneously.

AI Context

composable: useXAdminDashboard
package: "@xenterprises/nuxt-x-app-admin"
use-when: >
  Populating the admin dashboard page with live metrics, charts, system health
  status, and active user counts. Pass refreshInterval (ms) to enable polling.
pairs-with: XAdminDashboard, XAdminDashboardMetrics, XAdminDashboardRevenueChart, XAdminDashboardSystemHealth, XAdminDashboardActiveUsers
Copyright © 2026