Files
gridpilot.gg/apps/website/app/dashboard/page.tsx
2026-01-19 18:01:30 +01:00

28 lines
883 B
TypeScript

import { notFound, redirect } from 'next/navigation';
import { DashboardPageQuery } from '@/lib/page-queries/DashboardPageQuery';
import { DashboardPageClient } from '@/client-wrapper/DashboardPageClient';
import { logger } from '@/lib/infrastructure/logging/logger';
export default async function DashboardPage() {
const result = await DashboardPageQuery.execute();
if (result.isErr()) {
const error = result.getError();
// Handle different error types
if (error === 'notFound') {
notFound();
} else if (error === 'redirect') {
redirect('/');
} else {
// serverError, networkError, unknown, validationError, unauthorized
logger.error('Dashboard error', undefined, { errorType: error });
notFound();
}
}
// Success
const viewData = result.unwrap();
return <DashboardPageClient viewData={viewData} />;
}