From e183d3ddeb68212fcec225038314209f3bce8afa Mon Sep 17 00:00:00 2001 From: Sosokker Date: Sun, 3 Nov 2024 00:39:13 +0700 Subject: [PATCH] feat: add loading, error, not found page --- src/app/error.tsx | 19 +++++++++++++++++++ src/app/loading.tsx | 22 ++++++++++++++++++++++ src/app/not-found.tsx | 23 +++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/app/error.tsx create mode 100644 src/app/loading.tsx create mode 100644 src/app/not-found.tsx diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 0000000..5d0fe46 --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,19 @@ +"use client"; + +interface ErrorProps { + error: Error; + reset: () => void; +} + +export default function Error({ error, reset }: ErrorProps) { + return ( +
+

Something went wrong!

+

{error.message}

+ + +
+ ); +} diff --git a/src/app/loading.tsx b/src/app/loading.tsx new file mode 100644 index 0000000..97af30b --- /dev/null +++ b/src/app/loading.tsx @@ -0,0 +1,22 @@ +export default function Loading() { + return ( +
+
+ + + + +

Loading data...

+
+
+ ); +} diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 0000000..6c41fcd --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,23 @@ +import Link from "next/link"; + +function NotFound() { + return ( +
+
+

404

+

This page could not be found :(

+

+ Sorry, the page you are looking for does not exist or has been moved. +

+ + Go back home + +
+
+ ); +} + +export default NotFound;