import { useQuery } from '@tanstack/react-query'; import { api } from '@/lib/api'; import { Card, CardContent } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; interface AuditLog { id: string; action: string; userName: string; ipAddress: string | null; metadata: Record; createdAt: string; } interface PaginatedResponse { data: T[]; meta: { total: number }; } export function AdminAuditLogsPage() { const { data } = useQuery({ queryKey: ['admin-audit-logs'], queryFn: () => api.get>('/admin/audit-logs'), }); const logs = data?.data ?? []; return (

Audit Logs

{logs.map((log) => (
{log.action} {log.userName} {log.ipAddress && ( from {log.ipAddress} )}
{new Date(log.createdAt).toLocaleString()}
))} {logs.length === 0 && (
No audit logs
)}
); }