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

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

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

const mapDispatchToProps = {
  loadData: shop.actions.loadOne.request.action,
  dialogShow: app.actions.dialog.error.action,
};

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

export default Wrapped;
