Files
gridpilot.gg/apps/website/app/leagues/[id]/wallet/page.tsx
2026-01-14 13:39:24 +01:00

33 lines
849 B
TypeScript

import { LeagueWalletPageQuery } from '@/lib/page-queries/page-queries/LeagueWalletPageQuery';
import { LeagueWalletTemplate } from '@/templates/LeagueWalletTemplate';
import { notFound } from 'next/navigation';
interface Props {
params: { id: string };
}
export default async function LeagueWalletPage({ params }: Props) {
const leagueId = params.id;
if (!leagueId) {
notFound();
}
const result = await LeagueWalletPageQuery.execute(leagueId);
if (result.isErr()) {
const error = result.getError();
if (error.type === 'notFound') {
notFound();
}
// For serverError, show the template with empty data
return <LeagueWalletTemplate viewData={{
leagueId,
balance: 0,
currency: 'USD',
transactions: [],
}} />;
}
return <LeagueWalletTemplate viewData={result.unwrap()} />;
}