Add currentUser and isAuthenticated to authcontext
This commit is contained in:
@@ -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('/');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user