website refactor
This commit is contained in:
40
apps/website/client-wrapper/ServerErrorPageClient.tsx
Normal file
40
apps/website/client-wrapper/ServerErrorPageClient.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { ServerErrorTemplate, type ServerErrorViewData } from '@/templates/ServerErrorTemplate';
|
||||
|
||||
/**
|
||||
* ServerErrorPageClient
|
||||
*
|
||||
* Client-side entry point for the 500 page.
|
||||
* Manages navigation and retry logic and wires it to the template.
|
||||
*/
|
||||
export function ServerErrorPageClient() {
|
||||
const router = useRouter();
|
||||
|
||||
const handleHome = () => {
|
||||
router.push(routes.public.home);
|
||||
};
|
||||
|
||||
const handleRetry = () => {
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
const error = new Error('Internal Server Error') as Error & { digest?: string };
|
||||
error.digest = 'HTTP_500';
|
||||
|
||||
const viewData: ServerErrorViewData = {
|
||||
error,
|
||||
incidentId: error.digest
|
||||
};
|
||||
|
||||
return (
|
||||
<ServerErrorTemplate
|
||||
viewData={viewData}
|
||||
onRetry={handleRetry}
|
||||
onHome={handleHome}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user