import { Button } from 'antd';
import { actionAuthLogout } from '../action';
import { connect } from 'react-redux';
import { useHistory } from 'react-router-dom';

const ButtonExit = ({ authLogaut }) => {
  const history = useHistory();

  const exit = () => {
    authLogaut();
    history.push('/');
  };
  return (
    <Button onClick={exit}>Выход</Button>
  );
};

const ButtonExSite = connect(null, { authLogaut: actionAuthLogout })(ButtonExit);

export default ButtonExSite;
