Skip to content
Snippets Groups Projects
Verified Commit 88552367 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Apply simplified calls.

parent eff6ab95
No related branches found
No related tags found
2 merge requests!56Refined auth flow and new website pages.,!44New route type (RestrictedRoute) and better api calls.
...@@ -12,7 +12,6 @@ import { Unauthorized } from 'components/NonAuthUser/Unauthorized/Unauthorized'; ...@@ -12,7 +12,6 @@ import { Unauthorized } from 'components/NonAuthUser/Unauthorized/Unauthorized';
import { HomePage } from 'components/AuthUser/Dashboard/HomePage/HomePage'; import { HomePage } from 'components/AuthUser/Dashboard/HomePage/HomePage';
import { AuthContext } from 'components/AuthUser/AuthContext'; import { AuthContext } from 'components/AuthUser/AuthContext';
import { configDjangoCookieName } from 'api/configDjangoCookieName'; import { configDjangoCookieName } from 'api/configDjangoCookieName';
import { fetchCookie } from 'api/fetchCookie';
import { Dashboard } from 'components/AuthUser/Dashboard/Dashboard'; import { Dashboard } from 'components/AuthUser/Dashboard/Dashboard';
import { isAuthenticated } from 'api/isAuthenticated'; import { isAuthenticated } from 'api/isAuthenticated';
import { muiTheme } from 'App.style'; import { muiTheme } from 'App.style';
...@@ -25,14 +24,13 @@ export const App: FC = () => { ...@@ -25,14 +24,13 @@ export const App: FC = () => {
configDjangoCookieName(); configDjangoCookieName();
const [role, setRole] = useState(''); const [role, setRole] = useState('');
const [isAuth, setIsAuth] = useState<boolean>(false); const [isAuth, setIsAuth] = useState<boolean>(false);
const [isCookieFetched, setIsCookieFetched] = useState<string>('');
const value = { role, setRole, isAuth, setIsAuth }; const value = { role, setRole, isAuth, setIsAuth };
useEffect(() => { useEffect(() => {
// Initialize asking the server if this session is already logged in. // Initialize asking the server if this session is already logged in.
isAuthenticated().then((state) => setIsAuth(state)); isAuthenticated().then((responseState) => setIsAuth(responseState));
getRole(setRole); getRole().then((responseRole) => setRole(responseRole));
}, [isAuth, role]); }, [isAuth, role]);
return ( return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment