aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js
blob: 3daf831f84ca7f8ea9a3b441db70f9f2ef73ca6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import actions from '../actions'
import { connect } from 'react-redux'
import SaveVehicleJourneysComponent from '../components/SaveVehicleJourneys'

const mapStateToProps = (state) => {
  return {
    editMode: state.editMode,
    vehicleJourneys: state.vehicleJourneys,
    page: state.pagination.page,
    status: state.status,
    filters: state.filters
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    onEnterEditMode: () => {
      dispatch(actions.enterEditMode())
    },
    onExitEditMode: () => {
      dispatch(actions.cancelSelection())
      dispatch(actions.exitEditMode())
    },
    onSubmitVehicleJourneys: (next, state) => {
      actions.submitVehicleJourneys(dispatch, state, next)
    },
    validate: (state) =>{
      actions.validate(dispatch, state)
    }
  }
}

const SaveVehicleJourneys = connect(mapStateToProps, mapDispatchToProps)(SaveVehicleJourneysComponent)

export default SaveVehicleJourneys