From 6ae3d86417e15148742c4068c52049cf39b902ef Mon Sep 17 00:00:00 2001 From: soumitradev Date: Sat, 10 Feb 2024 21:10:05 +0530 Subject: [PATCH] feat: add a 404 route on frontend --- frontend/src/NotFound.tsx | 12 ++++++++++++ frontend/src/main.tsx | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 frontend/src/NotFound.tsx diff --git a/frontend/src/NotFound.tsx b/frontend/src/NotFound.tsx new file mode 100644 index 00000000..8d8675ae --- /dev/null +++ b/frontend/src/NotFound.tsx @@ -0,0 +1,12 @@ +import { Route } from "@tanstack/react-router"; +import { rootRoute } from "./main"; + +const notFoundRoute = new Route({ + getParentRoute: () => rootRoute, + path: "404", + component: () => { + return 404: Not Found; + }, +}); + +export default notFoundRoute; diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index c7b5f991..4c051efd 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -21,6 +21,7 @@ import indexRoute from "./Home"; import loginRoute from "./Login"; import RootComponent from "./RootComponent"; import viewTimetableRoute from "./ViewTimetable"; +import notFoundRoute from "./NotFound"; import "./index.css"; const queryClient = new QueryClient({ @@ -62,6 +63,7 @@ export const router = new Router({ context: { queryClient, }, + notFoundRoute: notFoundRoute, }); // Register things for typesafety