From 88552367a5578fe0b2f80481f050b8f7a4fb418c Mon Sep 17 00:00:00 2001 From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it> Date: Thu, 20 May 2021 14:57:04 +0200 Subject: [PATCH] Apply simplified calls. --- src/App.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 9b56843..71f71ed 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,6 @@ import { Unauthorized } from 'components/NonAuthUser/Unauthorized/Unauthorized'; import { HomePage } from 'components/AuthUser/Dashboard/HomePage/HomePage'; import { AuthContext } from 'components/AuthUser/AuthContext'; import { configDjangoCookieName } from 'api/configDjangoCookieName'; -import { fetchCookie } from 'api/fetchCookie'; import { Dashboard } from 'components/AuthUser/Dashboard/Dashboard'; import { isAuthenticated } from 'api/isAuthenticated'; import { muiTheme } from 'App.style'; @@ -25,14 +24,13 @@ export const App: FC = () => { configDjangoCookieName(); const [role, setRole] = useState(''); const [isAuth, setIsAuth] = useState<boolean>(false); - const [isCookieFetched, setIsCookieFetched] = useState<string>(''); const value = { role, setRole, isAuth, setIsAuth }; useEffect(() => { // Initialize asking the server if this session is already logged in. - isAuthenticated().then((state) => setIsAuth(state)); - getRole(setRole); + isAuthenticated().then((responseState) => setIsAuth(responseState)); + getRole().then((responseRole) => setRole(responseRole)); }, [isAuth, role]); return ( -- GitLab