File size: 750 Bytes
f5071ca |
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 |
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { fetchSpots } from '../../actions/spot_actions';
import { updateFilter } from '../../actions/filter_actions';
import SearchBar from './search_bar';
import { receiveSearch } from '../../actions/search_actions';
const msp = (state, ownProps) => {
return {
spots: Object.values(state.entities.spots),
search: state.ui.search
}
}
const mdp = (dispatch) => {
return {
fetchSpots: () => dispatch(fetchSpots()),
updateFilter: (filter, value) => dispatch(updateFilter(filter, value)),
receiveSearch: search => dispatch(receiveSearch(search))
}
}
export default withRouter(connect(msp, mdp)(SearchBar)); |