import { connect } from 'react-redux';
import { StoreState } from 'store/rootReducer';

import shop from 'store/shop';
import Manage, { StateProps, DispatchProps, OwnProps } from './Manage';

const mapStateToProps = (state: StoreState): {} => ({
  detail: state.shop.detail,
});

const mapDispatchToProps = {
  addData: shop.actions.add.request.action,
  loadData: shop.actions.loadOne.request.action,
  editData: shop.actions.edit.request.action,
  searchData: shop.actions.search.request.action,
};

const Wrapped = connect<StateProps, DispatchProps, OwnProps>(
  mapStateToProps,
  mapDispatchToProps,
)(Manage);

export default Wrapped;
