website refactor
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import type { ProfileLeaguesPageDto } from '@/lib/page-queries/page-queries/ProfileLeaguesPageQuery';
|
||||
import { ProfileLeaguesPresenter } from '@/lib/presenters/ProfileLeaguesPresenter';
|
||||
import { ProfileLeaguesTemplate } from '@/templates/ProfileLeaguesTemplate';
|
||||
|
||||
interface ProfileLeaguesPageClientProps {
|
||||
pageDto: ProfileLeaguesPageDto;
|
||||
}
|
||||
|
||||
export function ProfileLeaguesPageClient({ pageDto }: ProfileLeaguesPageClientProps) {
|
||||
// Convert Page DTO to ViewData using Presenter
|
||||
const viewData = ProfileLeaguesPresenter.toViewData(pageDto);
|
||||
|
||||
// Render Template with ViewData
|
||||
return <ProfileLeaguesTemplate viewData={viewData} />;
|
||||
}
|
||||
@@ -1,23 +1,24 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { ProfileLeaguesPageQuery } from '@/lib/page-queries/page-queries/ProfileLeaguesPageQuery';
|
||||
import { ProfileLeaguesPageClient } from './ProfileLeaguesPageClient';
|
||||
import { ProfileLeaguesTemplate } from '@/templates/ProfileLeaguesTemplate';
|
||||
|
||||
export default async function ProfileLeaguesPage() {
|
||||
const result = await ProfileLeaguesPageQuery.execute();
|
||||
|
||||
switch (result.status) {
|
||||
case 'notFound':
|
||||
if (result.isErr()) {
|
||||
const error = result.getError();
|
||||
|
||||
if (error === 'notFound') {
|
||||
notFound();
|
||||
case 'redirect':
|
||||
// Note: In Next.js, redirect would be imported from next/navigation
|
||||
// For now, we'll handle this case by returning notFound
|
||||
// In a full implementation, you'd use: redirect(result.to);
|
||||
} else if (error === 'redirect') {
|
||||
// In a real implementation, you'd use redirect('/')
|
||||
notFound();
|
||||
case 'error':
|
||||
// For now, treat errors as notFound
|
||||
// In a full implementation, you might render an error page
|
||||
} else {
|
||||
// For other errors, show notFound for now
|
||||
notFound();
|
||||
case 'ok':
|
||||
return <ProfileLeaguesPageClient pageDto={result.dto} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const viewData = result.unwrap();
|
||||
return <ProfileLeaguesTemplate viewData={viewData} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user