website refactor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { DriverProfilePageQuery } from '@/lib/page-queries/page-queries/DriverProfilePageQuery';
|
||||
import { DriverProfilePageClient } from './DriverProfilePageClient';
|
||||
import { DriverProfilePageClient } from '@/components/drivers/DriverProfilePageClient';
|
||||
|
||||
export default async function DriverProfilePage({ params }: { params: { id: string } }) {
|
||||
// Execute the page query
|
||||
@@ -9,7 +10,7 @@ export default async function DriverProfilePage({ params }: { params: { id: stri
|
||||
// Handle different result statuses
|
||||
switch (result.status) {
|
||||
case 'notFound':
|
||||
redirect('/404');
|
||||
redirect(routes.error.notFound);
|
||||
case 'redirect':
|
||||
redirect(result.to);
|
||||
case 'error':
|
||||
@@ -21,8 +22,8 @@ export default async function DriverProfilePage({ params }: { params: { id: stri
|
||||
/>
|
||||
);
|
||||
case 'ok':
|
||||
const pageDto = result.dto;
|
||||
const hasData = !!pageDto.currentDriver;
|
||||
const viewModel = result.dto;
|
||||
const hasData = !!viewModel.currentDriver;
|
||||
|
||||
if (!hasData) {
|
||||
return (
|
||||
@@ -38,7 +39,7 @@ export default async function DriverProfilePage({ params }: { params: { id: stri
|
||||
|
||||
return (
|
||||
<DriverProfilePageClient
|
||||
pageDto={pageDto}
|
||||
pageDto={viewModel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user