Add currentUser and isAuthenticated to authcontext

This commit is contained in:
2020-08-22 18:33:42 +02:00
parent a52bc8f7ab
commit 3356c380d7
7 changed files with 72 additions and 15 deletions

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import { Nav, Icon, Dropdown, Popover, Whisper } from 'rsuite';
import { useAuth } from '../../helpers/authContext';
export default function MenuDropdown() {
const { setIsAuthenticated } = useAuth();
const history = useHistory();
const triggerRef = React.createRef();
@@ -12,8 +16,7 @@ export default function MenuDropdown() {
}
function handleLogout() {
localStorage.removeItem('token');
localStorage.removeItem('user');
setIsAuthenticated(false);
history.push('/');
}