From 5f35b416d838e01c9723c059d1a5ed33d1eb6c3a Mon Sep 17 00:00:00 2001 From: jarellb Date: Thu, 24 Oct 2024 09:58:36 -1000 Subject: [PATCH] Implement error.tsx with default home spacing --- ui/src/app/error.tsx | 30 +++++++++++++++++++++ ui/src/app/layout.tsx | 14 +++++----- ui/src/components/modal/api-error-modal.tsx | 4 ++- ui/src/lib/http-client.ts | 5 ++-- ui/tests/lib/fetchers.test.ts | 3 ++- 5 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 ui/src/app/error.tsx diff --git a/ui/src/app/error.tsx b/ui/src/app/error.tsx new file mode 100644 index 00000000..b100986d --- /dev/null +++ b/ui/src/app/error.tsx @@ -0,0 +1,30 @@ +'use client'; + +import { useState } from 'react'; +import ApiErrorModal from '@/components/modal/api-error-modal'; + +interface ErrorProps { + reset: () => void; +} + +const Error = ({ reset }: ErrorProps) => { + const [open, setOpen] = useState(true); + + const handleClose = () => { + setOpen(false); + reset(); + }; + + return ( +
+ {open && ( + + )} +
+ ); +}; + +export default Error; diff --git a/ui/src/app/layout.tsx b/ui/src/app/layout.tsx index 30116baf..c3dd7247 100644 --- a/ui/src/app/layout.tsx +++ b/ui/src/app/layout.tsx @@ -25,13 +25,13 @@ const RootLayout = ({ }: Readonly<{ children?: React.ReactNode; }>) => ( - - - -
{children}
-