Files
gridpilot.gg/apps/website/app/leagues/[id]/standings/page.tsx
Marc Mintel 1b0a1f4aee
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-24 23:29:55 +01:00

41 lines
975 B
TypeScript

import { LeagueStandingsPageQuery } from '@/lib/page-queries/LeagueStandingsPageQuery';
import { LeagueStandingsTemplate } from '@/templates/LeagueStandingsTemplate';
import { notFound } from 'next/navigation';
interface Props {
params: Promise<{ id: string }>;
}
export default async function Page({ params }: Props) {
const { id: leagueId } = await params;
if (!leagueId) {
notFound();
}
const result = await LeagueStandingsPageQuery.execute(leagueId);
if (result.isErr()) {
const error = result.getError();
if (error === 'notFound') {
notFound();
}
// For serverError, show the template with empty data
return <LeagueStandingsTemplate
viewData={{
standings: [],
drivers: [],
memberships: [],
leagueId,
currentDriverId: null,
isAdmin: false,
isTeamChampionship: false,
}}
/>;
}
return <LeagueStandingsTemplate
viewData={result.unwrap()}
/>;
}