From 8a54ae24564d120cd49038d7e2f288640c404f7a Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:31:57 +0100 Subject: [PATCH] feat: add NotFound component to handle 404 errors and redirect unauthenticated users --- app/not-found.tsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/not-found.tsx diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 00000000..c1d0dd64 --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { useEffect } from "react"; +import { useAuthStore } from "@/stores/auth-store"; + +export default function NotFound() { + const isAuthenticated = useAuthStore((s) => s.isAuthenticated); + + useEffect(() => { + if (!isAuthenticated) { + window.location.href = "/login"; + } + }, [isAuthenticated]); + + if (!isAuthenticated) { + return null; + } + + return ( +
+
+

404

+

This page could not be found.

+ + Go home + +
+
+ ); +}