From 2c9b06620d2064b9b141c3456b08bd3fed92acb3 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:09:18 +0200
Subject: [PATCH] Set isAuth after role is chosen.

---
 src/components/Auth/ChoseRole/ChoseRole.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/components/Auth/ChoseRole/ChoseRole.tsx b/src/components/Auth/ChoseRole/ChoseRole.tsx
index ce2688c..334e2bb 100644
--- a/src/components/Auth/ChoseRole/ChoseRole.tsx
+++ b/src/components/Auth/ChoseRole/ChoseRole.tsx
@@ -1,9 +1,10 @@
-import React, { FC, useEffect, useState } from 'react';
+import React, { FC, useContext, useEffect, useState } from 'react';
 import Button from '@material-ui/core/Button';
 import { getRoles } from 'api/getRoles';
 import { setRole } from 'api/setRole';
 import { useHistory } from 'react-router-dom';
 import { AuthRoutes } from 'api/routes';
+import { AuthContext } from 'components/Auth/AuthContext';
 
 /**
  * Page that let's users decide role between available roles.
@@ -13,10 +14,12 @@ import { AuthRoutes } from 'api/routes';
 export const ChoseRole: FC = () => {
   const history = useHistory();
   const [userRoles, setUserRoles] = useState<string[]>(['']);
+  const { setIsAuth } = useContext(AuthContext);
 
   const choseAndForward = (role: string): void => {
     // Set role in the server.
     setRole(role);
+    setIsAuth(true);
     // Push to homepage.
     history.push(`${AuthRoutes.dashboard}${AuthRoutes.home}`);
   };
-- 
GitLab