import { notFound } from 'next/navigation'; import { LeaguesPageClient } from './LeaguesPageClient'; import { LeaguesPageQuery } from '@/lib/page-queries/LeaguesPageQuery'; export default async function Page() { // Execute the PageQuery const result = await LeaguesPageQuery.execute(); // Handle different result types if (result.isErr()) { const error = result.getError(); switch (error) { case 'notFound': notFound(); case 'redirect': // In a real app, this would redirect to login notFound(); case 'LEAGUES_FETCH_FAILED': case 'UNKNOWN_ERROR': default: // Return error state - use LeaguesTemplate with empty data return ; } } const viewData = result.unwrap(); return ; }