import React from 'react'; import { withRouter } from 'react-router-dom'; import { client, CLIENT_DEFAULT_TAB } from 'App/routes'; import { Icon } from 'UI'; import { getInitials } from 'App/utils'; import { useStore } from "App/mstore"; import { observer } from 'mobx-react-lite'; const CLIENT_PATH = client(CLIENT_DEFAULT_TAB); interface Props { history: any; } function UserMenu(props: Props) { const { history }: any = props; const { loginStore, userStore } = useStore(); const account = userStore.account; const onLogoutClick = userStore.logout; const onAccountClick = () => { history.push(CLIENT_PATH); }; const onLogout = () => { loginStore.invalidateSpotJWT() window.postMessage({ type: "orspot:invalidate" }, "*") void onLogoutClick(); } return (
{getInitials(account.name)}
{account.name}
{account.email}
{account.superAdmin ? 'Owner' : account.admin ? 'Admin' : 'Member'}
); } export default withRouter(observer(UserMenu))