fix: FINNALY FIXED AND COMPILABLE

This commit is contained in:
2026-06-24 11:37:56 +01:00
parent e9555c9f74
commit 426c1c50a0
13 changed files with 56 additions and 62 deletions
+9 -8
View File
@@ -4,10 +4,11 @@
import { query } from '@/lib/db';
import Link from 'next/link';
import EventResultsClient from '@/components/events/EventResultsClient';
import { Event } from '@/types/racing';
export const dynamic = "force-dynamic";
async function getEventResults(eventId: number) {
async function getEventResults(eventId: string) {
if (eventId == undefined) {
return { event: null, standings: [] };
@@ -23,8 +24,8 @@ async function getEventResults(eventId: number) {
FROM events
WHERE event_id = $1
`;
const events = await query(eventSql, [String(eventId)]);
const event = events[0];
const events = await query(eventSql, [eventId]);
const event = (events[0] as Event) ?? null;
// Get team standings with driver details
const standingsSql = `
@@ -55,20 +56,20 @@ async function getEventResults(eventId: number) {
const standings = await query(standingsSql, [eventId]);
return { event, standings };
return { event, standings: standings as any[] };
}
export default async function EventResultsPage({
params,
}: {
params: Promise<{ event_id: number }>;
params: Promise<{ event_id: string }>;
}) {
const { event_id } = await params;
const { event_id } = await params;
const eventId = parseInt(event_id, 10);
console.log('Fetching results for event ID:', event_id);
const { event, standings } = await getEventResults(event_id);
if (!event) {
return (
<div className="max-w-7xl mx-auto px-6 py-16">
@@ -110,7 +111,7 @@ export default async function EventResultsPage({
{/* Team Championship Standings */}
<div className="max-w-7xl mx-auto px-6 py-12">
<EventResultsClient
eventId={event_id}
eventId={eventId}
initialStandings={standings}
/>