import { memo, MouseEventHandler, useState } from 'react' import { Link, useHistory } from 'react-router-dom' import { Button, Dropdown, DropDownProps, Menu } from 'antd' import { UserOutlined } from '@ant-design/icons' import { getUserLogin, removeUser } from '@utils/storage' import { ChangePassword } from './ChangePassword' import { PrivateMenuItemLink } from './Private/PrivateMenuItem' type UserMenuProps = Omit & { isAdmin?: boolean } export const UserMenu = memo(({ isAdmin, ...other }) => { const [isModalVisible, setIsModalVisible] = useState(false) const history = useHistory() const onChangePasswordClick: MouseEventHandler = (e) => { setIsModalVisible(true) e.preventDefault() } const onChangePasswordOk = () => { setIsModalVisible(false) history.push('/login') } return ( <> {isAdmin ? ( ) : ( )} Сменить пароль Выход )} > setIsModalVisible(false)} /> ) })