From cd2a81e7f2c755f31931e41b3fb7a308b306bd5d Mon Sep 17 00:00:00 2001 From: Mattias <mattias.rasmusson.1032@student.lu.se> Date: Tue, 19 Mar 2024 22:50:40 +0100 Subject: [PATCH] Added unauthorizedpage and path in main --- frontend/src/Pages/UnauthorizedPage.tsx | 18 ++++++++++++++++++ frontend/src/main.tsx | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 frontend/src/Pages/UnauthorizedPage.tsx diff --git a/frontend/src/Pages/UnauthorizedPage.tsx b/frontend/src/Pages/UnauthorizedPage.tsx new file mode 100644 index 0000000..ed21b25 --- /dev/null +++ b/frontend/src/Pages/UnauthorizedPage.tsx @@ -0,0 +1,18 @@ +import Button from "../Components/Button"; + +export default function UnauthorizedPage(): JSX.Element { + return ( + <div className="flex flex-col items-center justify-center min-h-screen bg-white"> + <h1 className="text-[30px]">Unauthorized</h1> + <a href="/"> + <Button + text="Go to Home Page" + onClick={(): void => { + localStorage.clear(); + }} + type="button" + /> + </a> + </div> + ); +} \ No newline at end of file diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 20ecbcd..29a67d1 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -30,6 +30,7 @@ import AdminProjectStatistics from "./Pages/AdminPages/AdminProjectStatistics.ts import AdminProjectViewMemberInfo from "./Pages/AdminPages/AdminProjectViewMemberInfo.tsx"; import AdminProjectPage from "./Pages/AdminPages/AdminProjectPage.tsx"; import NotFoundPage from "./Pages/NotFoundPage.tsx"; +import UnauthorizedPage from "./Pages/UnauthorizedPage.tsx"; // This is where the routes are mounted const router = createBrowserRouter([ @@ -146,6 +147,10 @@ const router = createBrowserRouter([ path: "/adminManageUser", element: <AdminManageUsers />, }, + { + path: "unauthorized", + element: <UnauthorizedPage />, + }, ]); // Semi-hacky way to get the root element