import React, { useState } from "react"; import { IconButton, Menu, MenuItem } from "@material-ui/core"; import AccountCircle from "@material-ui/icons/AccountCircle"; import { useHistory } from "react-router-dom"; import { useTuitioClient } from "@flare/tuitio-client-react"; import { useToast } from "../../hooks"; const ProfileButton = () => { const history = useHistory(); const { error } = useToast(); const { logout } = useTuitioClient({ onLogoutFailed: errorMessage => error(errorMessage), onLogoutError: err => error(err.message) }); const [anchorEl, setAnchorEl] = useState(null); const openUserMenu = Boolean(anchorEl); const handleMenu = event => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; return (