42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { LeagueWalletPageQuery } from '@/lib/page-queries/LeagueWalletPageQuery';
|
|
import { LeagueWalletPageClient } from '@/client-wrapper/LeagueWalletPageClient';
|
|
import { notFound } from 'next/navigation';
|
|
|
|
interface Props {
|
|
params: Promise<{ id: string }>;
|
|
}
|
|
|
|
export default async function LeagueWalletPage({ params }: Props) {
|
|
const { id: leagueId } = await params;
|
|
|
|
if (!leagueId) {
|
|
notFound();
|
|
}
|
|
|
|
const result = await LeagueWalletPageQuery.execute(leagueId);
|
|
|
|
if (result.isErr()) {
|
|
const error = result.getError();
|
|
if (error === 'notFound') {
|
|
notFound();
|
|
}
|
|
// For serverError, show the template with empty data
|
|
return <LeagueWalletPageClient viewData={{
|
|
leagueId,
|
|
balance: 0,
|
|
formattedBalance: '$0.00',
|
|
totalRevenue: 0,
|
|
formattedTotalRevenue: '$0.00',
|
|
totalFees: 0,
|
|
formattedTotalFees: '$0.00',
|
|
pendingPayouts: 0,
|
|
formattedPendingPayouts: '$0.00',
|
|
currency: 'USD',
|
|
transactions: [],
|
|
totalWithdrawals: 0,
|
|
canWithdraw: false,
|
|
}} />;
|
|
}
|
|
|
|
return <LeagueWalletPageClient viewData={result.unwrap()} />;
|
|
} |