import React from 'react';
import style from './buttonDeleteOrder.module.sass';
import {connect} from 'react-redux';
import {deleteOrder} from "../../../actions/actionCreator";

const ButtonDeleteOrder = (props) => {
    const {goodId} = props;

    return(
      <div className={style.mainContainer} onClick={() => props.deleteOrder(goodId)}>
          <h2>Отменить заказ</h2>
      </div>
    );
};

const mapStateToProps = state => {
  const {historyOrders} = state.historyOrdersReducers;

  return {
      historyOrders
  }
};

const mapDispatchToProps = dispatch => ({
   deleteOrder: (id) => (dispatch(deleteOrder(id)))
});

export default connect(mapStateToProps, mapDispatchToProps)(ButtonDeleteOrder);