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
| Key | Type | Description |
|---|---|---|
health | Ref<SystemHealth> | Current system health status (CPU, memory, disk, services). |
metrics | Ref<DashboardMetrics> | Configurable metrics grid data (totals, deltas, trends). |
activeUsers | Ref<number> | Real-time count of active users. |
revenueHistory | Ref<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
