From 72ff2611c3b20e887835b56ffc25ba94e2c0006c Mon Sep 17 00:00:00 2001 From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it> Date: Thu, 15 Apr 2021 09:32:54 +0200 Subject: [PATCH] Implement basic NotAuth and NotFound page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit geändert: src/App.tsx --- src/App.tsx | 4 ++++ src/components/NotFound/NotFound.tsx | 3 +++ src/components/Unauthorized/Unauthorized.tsx | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index 191f80b..f0a86b4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,9 @@ import { AuthUser } from 'components/AuthUser/AuthUser'; import { LandingPage } from 'components/LandingPage/LandingPage'; import { PrivateRoute } from 'components/api/PrivateRoute/PrivateRoute'; import { AuthRoutes, NonAuthRoutes } from 'components/api/routes'; +import { NotFound } from 'components/NotFound/NotFound'; import { Roles } from 'components/api/userRoles'; +import { Unauthorized } from 'components/Unauthorized/Unauthorized'; export const App: FC = () => ( <Router> @@ -18,6 +20,8 @@ export const App: FC = () => ( Component={HomePage} requiredRoles={[Roles.admin, Roles.operator, Roles.senior]} /> + <Route path={NonAuthRoutes.unauthorized} component={Unauthorized} /> + <Route component={NotFound} /> </Switch> </div> </Router> diff --git a/src/components/NotFound/NotFound.tsx b/src/components/NotFound/NotFound.tsx index e69de29..f514a0f 100644 --- a/src/components/NotFound/NotFound.tsx +++ b/src/components/NotFound/NotFound.tsx @@ -0,0 +1,3 @@ +import React, { FC } from 'react'; + +export const NotFound: FC = () => <h1>Page not found</h1>; diff --git a/src/components/Unauthorized/Unauthorized.tsx b/src/components/Unauthorized/Unauthorized.tsx index e69de29..0e53bf5 100644 --- a/src/components/Unauthorized/Unauthorized.tsx +++ b/src/components/Unauthorized/Unauthorized.tsx @@ -0,0 +1,3 @@ +import React, { FC } from 'react'; + +export const Unauthorized: FC = () => <h1>You cannot access this page</h1>; -- GitLab