Version 1.0 - Stable
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
// app/api/events/[id]/results/route.ts
|
||||
// app/api/events/[event_id]/results/route.ts
|
||||
import { query } from '@/lib/db';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NextResponse, NextRequest } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
request: NextRequest,
|
||||
context: { params: Promise<{ event_id: string }> }
|
||||
) {
|
||||
|
||||
const { event_id } = await context.params;
|
||||
|
||||
try {
|
||||
const standingsSql = `
|
||||
SELECT
|
||||
@@ -35,7 +38,7 @@ export async function GET(
|
||||
ORDER BY tcs.total_points DESC, tcs.best_finish ASC
|
||||
`;
|
||||
|
||||
const standings = await query(standingsSql, [params.id]);
|
||||
const standings = await query(standingsSql, [event_id]);
|
||||
|
||||
return NextResponse.json({ standings });
|
||||
} catch (error) {
|
||||
Reference in New Issue
Block a user