Composables
useXAdminAuditLog
Queries the system-wide audit log by user or resource and exports log data to CSV or other formats.
useXAdminAuditLog
Audit log composable. Wraps GET /api/admin/audit-log and POST /api/admin/audit-log/export with typed query helpers that filter by user, resource type, action, or date range, plus an export method for offline analysis. Pairs with XAdminAuditLog.
Usage
const auditLog = useXAdminAuditLog()
await auditLog.getLogsByUser(userId)
await auditLog.getLogsByResource("users", resourceId)
await auditLog.exportLogs("csv")
Returns
| Key | Type | Description |
|---|---|---|
getLogsByUser | (userId: string) => Promise<AuditLogEntry[]> | Fetches all audit log entries attributed to a specific user. |
getLogsByResource | (resourceType: string, resourceId: string) => Promise<AuditLogEntry[]> | Fetches audit entries for a specific resource (e.g. "users", a user ID). |
exportLogs | (format: "csv" | "json") => Promise<void> | Triggers a log export download in the specified format. |
AI Context
composable: useXAdminAuditLog
package: "@xenterprises/nuxt-x-app-admin"
use-when: >
Querying or exporting the system audit trail in the admin panel — filtering
entries by user, resource type, action type, or date range, and exporting
results for compliance or offline review.
pairs-with: XAdminAuditLog
