import { getTunnelsList } from '@/lib/admin/list';
import { TunnelsTable } from './tunnels-table';

export const dynamic = 'force-dynamic';
export const revalidate = 0;

const PER_PAGE = 25;

export default async function AdminTunnelsPage() {
  // Initial load on the server (admin session already validated by the layout)
  // so the first paint never races the client session-cookie refresh.
  const { tunnels, total } = await getTunnelsList({
    page: 1,
    perPage: PER_PAGE,
    search: '',
    status: null,
  });

  return <TunnelsTable initialTunnels={tunnels} initialTotal={total} />;
}
