aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/MoreMenu.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/ProfilePage/MoreMenu.tsx')
-rw-r--r--src/pages/ProfilePage/MoreMenu.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pages/ProfilePage/MoreMenu.tsx b/src/pages/ProfilePage/MoreMenu.tsx
index 7c17f1e..4e681f5 100644
--- a/src/pages/ProfilePage/MoreMenu.tsx
+++ b/src/pages/ProfilePage/MoreMenu.tsx
@@ -5,6 +5,7 @@ import MenuItem from '@material-ui/core/MenuItem';
import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
import { makeStyles } from '@material-ui/core';
import { useAuth } from '../../hooks/useAuth';
+import { useNavigate } from '../../hooks/useNavigate';
const ITEM_HEIGHT = 48;
@@ -20,6 +21,7 @@ const MoreMenu: React.FC = () => {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);
const { logout } = useAuth();
+ const { navigate } = useNavigate();
const open = Boolean(anchorEl);
@@ -27,6 +29,11 @@ const MoreMenu: React.FC = () => {
setAnchorEl(event.currentTarget);
};
+ const handleLogout = () => {
+ logout();
+ navigate('auth');
+ };
+
const handleClose = () => {
setAnchorEl(null);
};
@@ -55,7 +62,7 @@ const MoreMenu: React.FC = () => {
}
}}
>
- <MenuItem onClick={logout}>Log out</MenuItem>
+ <MenuItem onClick={handleLogout}>Log out</MenuItem>
</Menu>
</div>
</div>