diff --git a/src/App.tsx b/src/App.tsx index eff19068d86ecac464c94e0705e65735672d1df3..458470b04401c6a1593bef169628b611cd9916d9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,6 +10,7 @@ export const App: FC = () => ( <Switch> <Route path="/auth" component={AuthUser} /> <Route exact path="/" component={LandingPage} /> + <Route exact path="/home" component={HomePage} /> </Switch> </div> </Router> diff --git a/src/components/AuthUser/AuthUser.tsx b/src/components/AuthUser/AuthUser.tsx index 52b4a2b1c270be80ca3598d841c40ec4c6f1e0a5..51621049d7d74beaf16d4e6a60f0933d454b2bdd 100644 --- a/src/components/AuthUser/AuthUser.tsx +++ b/src/components/AuthUser/AuthUser.tsx @@ -7,10 +7,11 @@ export const AuthUser: FC = () => { useEffect(() => { axios .get('api/web/csrf') - .then((response) => - sessionStorage.setItem('CSRF_TOKEN', response.data.token), - ) - .catch((error) => console.log(error)); + .then((response) => { + // Check this https://stackoverflow.com/questions/39254562/csrf-with-django-reactredux-using-axios + axios.defaults.headers.common['X-CSRFTOKEN'] = response.data.token; + }) + .catch((error) => error); }, []); return ( <Container maxWidth="sm"> diff --git a/src/components/LandingPage/LandingPage.tsx b/src/components/LandingPage/LandingPage.tsx index 51f422645bf8db6a8990794dfdbc6cfb6fc97b05..5567be0bdcc3aa06af023345824b31163ce6288a 100644 --- a/src/components/LandingPage/LandingPage.tsx +++ b/src/components/LandingPage/LandingPage.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect } from 'react'; +import React, { FC } from 'react'; export const LandingPage: FC = () => ( <> diff --git a/src/components/LandingPage/TeamPage.tsx b/src/components/LandingPage/TeamPage.tsx index 58d850befb0555629c9a8391f6176e57ec393e03..b0a945e8347fdc1b4c1027ea1cf3a03df91eb95d 100644 --- a/src/components/LandingPage/TeamPage.tsx +++ b/src/components/LandingPage/TeamPage.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect } from 'react'; +import React, { FC } from 'react'; export const TeamPage: FC = () => ( <>