import { useEffect, useState } from "react"; import { api, handleError } from "../../lib/utils"; import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, } from "@nextui-org/react"; type AuditLogAction = "BAN_CREATE" | "BAN_UPDATE" | "BAN_DELETE"; type AuditLog = { id: number; userId: string; action: AuditLogAction; reason?: string; comment?: string; banId?: number; createdAt: string; updatedAt?: string; }; export const AuditLog = () => { const [auditLogs, setAuditLogs] = useState([]); useEffect(() => { api<{ auditLogs: AuditLog[] }>("/api/admin/audit", "GET").then( ({ status, data }) => { if (status === 200) { if (data.success) { setAuditLogs(data.auditLogs); } else { handleError(status, data); } } else { handleError(status, data); } } ); }, []); return ( <>

Audit Log

ID User ID Action Reason Comment Created At / Updated At {auditLogs.map((log) => ( {log.id} {log.userId} {log.action} {log.reason} {log.comment} {log.createdAt} / {log.updatedAt} ))}
); };