23 lines
702 B
TypeScript
23 lines
702 B
TypeScript
import { HomePageClient } from '@/client-wrapper/HomePageClient';
|
|
import { PageDataFetcher } from '@/lib/page/PageDataFetcher';
|
|
import { HomePageQuery } from '@/lib/page-queries/HomePageQuery';
|
|
import { notFound, redirect } from 'next/navigation';
|
|
import { routes } from '@/lib/routing/RouteConfig';
|
|
|
|
export default async function Page() {
|
|
if (await HomePageQuery.shouldRedirectToDashboard()) {
|
|
redirect(routes.protected.dashboard);
|
|
}
|
|
|
|
const data = await PageDataFetcher.fetchManual(async () => {
|
|
const result = await HomePageQuery.execute();
|
|
return result.isOk() ? result.unwrap() : null;
|
|
});
|
|
|
|
if (!data) {
|
|
notFound();
|
|
}
|
|
|
|
return <HomePageClient viewData={data} />;
|
|
}
|