From f524df7e1b01abe73a51e9cd625bd0f170b21e50 Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 18 Nov 2023 00:55:25 -0500 Subject: [PATCH] Better error handling --- app/layout.tsx | 2 +- app/page.tsx | 53 +++++++++++++++++++++++++------------------------- package.json | 1 + 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 0b1f308..a75a3ca 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -28,7 +28,7 @@ export default function RootLayout({ enableSystem disableTransitionOnChange > - + {children} diff --git a/app/page.tsx b/app/page.tsx index 37f8cfb..fca34ca 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button'; import { useRoutes } from '@/lib/clientActions'; import Image from 'next/image'; import Loading from '@/components/Loading'; +import Error from '@/components/Error'; export default function Home() { @@ -13,32 +14,30 @@ export default function Home() { const { data: routes, error, isLoading } = useRoutes(); let routesMap: Route[] = routes as Route[]; - if (error) return
Error loading routes
- if(isLoading) return ( - - ) + if(error) return + if(isLoading) return - return ( -
-
- - - Active Routes - Amount of configured routes - - -
-

{routesMap.length}

-
-
- - - -
-
-
- -
-
- ) + return ( +
+
+ + + Active Routes + Amount of configured routes + + +
+

{routesMap.length}

+
+
+ + + +
+
+
+ +
+
+ ) } diff --git a/package.json b/package.json index 45c0175..114db54 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-navigation-menu": "^1.1.4",