Skip to content

Commit

Permalink
feat: add a 404 route on frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
soumitradev committed Feb 10, 2024
1 parent 194200b commit 6ae3d86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/src/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Route } from "@tanstack/react-router";
import { rootRoute } from "./main";

const notFoundRoute = new Route({
getParentRoute: () => rootRoute,
path: "404",
component: () => {
return <span>404: Not Found</span>;
},
});

export default notFoundRoute;
2 changes: 2 additions & 0 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -62,6 +63,7 @@ export const router = new Router({
context: {
queryClient,
},
notFoundRoute: notFoundRoute,
});

// Register things for typesafety
Expand Down

0 comments on commit 6ae3d86

Please sign in to comment.