diff --git a/frontend/src/App.js b/frontend/src/App.js index 45b83f7..9594b72 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -5,14 +5,66 @@ import Login from './pages/Login' import Register from './pages/Register' import Habits from './pages/Habits' import Goals from './pages/Goals' -import Header from './components/Header' +//import Header from './components/Header' + +import {FaSignInAlt, FaSignOutAlt, FaUser} from 'react-icons/fa' +import {Link, useNavigate} from 'react-router-dom' +import {useSelector, useDispatch} from 'react-redux' +import {logout, resetAuth} from './features/auth/authSlice' +import {resetGoals} from './features/goals/goalsSlice' +import { resetHabits } from './features/habits/habitsSlice' + + +function Header() { + + const navigate = useNavigate() + const dispatch = useDispatch() + const {user} = useSelector((state) => state.auth) + + const onLogout = () => { + dispatch(logout()) + dispatch(resetAuth()) + dispatch(resetGoals()) + dispatch(resetHabits()) + navigate('/') + } + + //console.log(user) + + return ( +
+
+ CarAIbou +
+ +
+ ) +} + function App() { return ( <>
-
+
} /> } />