From 36a8fd8780594e1cec01db13cd3f26ece9c40049 Mon Sep 17 00:00:00 2001 From: skidoodle Date: Wed, 24 Jan 2024 10:37:19 +0100 Subject: [PATCH] use deterministic returns --- src/pages/_error.tsx | 50 ++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/pages/_error.tsx b/src/pages/_error.tsx index bb273f5..50529de 100644 --- a/src/pages/_error.tsx +++ b/src/pages/_error.tsx @@ -1,12 +1,33 @@ import { Footer } from '@/components/Footer' import { Button } from '@nextui-org/button' -import Link from 'next/link' import type { GetServerSideProps, GetServerSidePropsContext } from 'next' interface ErrorProps { statusCode: number } +const NotFound: React.FC = () => ( + <> +

Az keresett oldal nem található.

+

+ +

+ +) + +const Unexpected: React.FC = () => ( + <> +

Váratlan hiba történt.

+

+ +

+ +) + const ErrorPage: React.FC = ({ statusCode }) => { return ( <> @@ -19,25 +40,14 @@ const ErrorPage: React.FC = ({ statusCode }) => {
- {statusCode == 404 ? ( - <> -

Az keresett oldal nem található.

-

- -

- - ) : ( - <> -

Váratlan hiba történt.

-

- -

- - )} + {(() => { + switch (statusCode) { + case 404: + return + default: + return + } + })()}