diff --git a/src/App.tsx b/src/App.tsx index 9b5684311a82f9b5b3ee307ed30993802bc9a5f5..71f71ed8d7b0d8b621924540b9b2bdbc2ed82ed2 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 (