import { getAuditList } from '@/lib/admin/list';
import { AuditTable } from './audit-table';

export const dynamic = 'force-dynamic';

const PER_PAGE = 50;

export default async function AdminAuditPage() {
  // Initial load on the server (admin session already validated by the layout)
  // so the first paint never races the client session-cookie refresh.
  const { entries, total } = await getAuditList({
    page: 1,
    perPage: PER_PAGE,
    action: '',
    targetType: '',
  });

  return <AuditTable initialEntries={entries} initialTotal={total} />;
}
