From d3a527bb167ba2921df3b063b8b27103b3618af9 Mon Sep 17 00:00:00 2001
From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it>
Date: Thu, 27 May 2021 15:28:31 +0200
Subject: [PATCH] Apply new Authorization.

---
 src/App.tsx | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/App.tsx b/src/App.tsx
index 4d6bf8e..facca47 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -15,7 +15,12 @@ import { NotFound } from 'components/NotFound/NotFound';
 import { Unauthorized } from 'components/Unauthorized/Unauthorized';
 import { LandingPage } from 'components/LandingPage/LandingPage';
 
-const Personal = withAuthorization(Dashboard);
+const All = withAuthorization([
+  Roles.admin,
+  Roles.operator,
+  Roles.senior,
+  Roles.driver,
+]);
 
 /**
  * Entry point of the app.
@@ -35,19 +40,7 @@ export const App: FC = () => {
             <Switch>
               <Route exact path={NonAuthRoutes.home} component={LandingPage} />
               <Route path={NonAuthRoutes.auth} component={AuthUser} />
-              <Route
-                path={AuthRoutes.dashboard}
-                render={() => (
-                  <Personal
-                    allowedRoles={[
-                      Roles.admin,
-                      Roles.operator,
-                      Roles.senior,
-                      Roles.driver,
-                    ]}
-                  />
-                )}
-              />
+              <Route path={AuthRoutes.dashboard} component={All(Dashboard)} />
               <Route
                 path={NonAuthRoutes.unauthorized}
                 component={Unauthorized}
-- 
GitLab