website refactor
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamsPageQuery } from '@/lib/page-queries/page-queries/TeamsPageQuery';
|
||||
import { TeamsViewDataBuilder } from '@/lib/builders/view-data/TeamsViewDataBuilder';
|
||||
import { TeamsPageClient } from './TeamsPageClient';
|
||||
|
||||
export default async function Page() {
|
||||
const result = await TeamsPageQuery.execute();
|
||||
const query = new TeamsPageQuery();
|
||||
const result = await query.execute();
|
||||
|
||||
switch (result.status) {
|
||||
case 'ok':
|
||||
const viewData = TeamsViewDataBuilder.build(result.dto);
|
||||
return <TeamsPageClient teams={viewData.teams} />;
|
||||
case 'notFound':
|
||||
notFound();
|
||||
case 'redirect':
|
||||
// This would typically use redirect() from next/navigation
|
||||
// but we need to handle it at the page level
|
||||
return null;
|
||||
case 'error':
|
||||
// For now, treat errors as not found
|
||||
// In production, you might want a proper error page
|
||||
notFound();
|
||||
if (result.isErr()) {
|
||||
notFound();
|
||||
}
|
||||
}
|
||||
|
||||
const viewData = result.unwrap();
|
||||
return <TeamsPageClient viewData={viewData} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user