website refactor
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
import { PageWrapper } from '@/components/shared/state/PageWrapper';
|
||||
import { HomeTemplate, type HomeViewData } from '@/templates/HomeTemplate';
|
||||
import { PageDataFetcher } from '@/lib/page/PageDataFetcher';
|
||||
import { HomeService } from '@/lib/services/home/HomeService'; // @server-safe
|
||||
import { HomePageQuery } from '@/lib/page-queries/HomePageQuery';
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
|
||||
export default async function Page() {
|
||||
const homeService = new HomeService();
|
||||
|
||||
if (await homeService.shouldRedirectToDashboard()) {
|
||||
if (await HomePageQuery.shouldRedirectToDashboard()) {
|
||||
redirect(routes.protected.dashboard);
|
||||
}
|
||||
|
||||
const data = await PageDataFetcher.fetchManual(async () => {
|
||||
const result = await homeService.getHomeData();
|
||||
const result = await HomePageQuery.execute();
|
||||
return result.isOk() ? result.unwrap() : null;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user