Only map the required props/funcs to the show list view

This commit is contained in:
Grégoire Delattre 2017-05-23 21:16:10 +02:00
parent 3a93433703
commit 1d1e239709

View File

@ -1,7 +1,8 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as actionCreators from '../../actions/actionCreators'
import { selectShow, addShowToWishlist,
deleteFromWishlist, getShowDetails } from '../../actions/actionCreators'
import ListDetails from '../list/details'
import ListPosters from '../list/posters'
@ -11,15 +12,10 @@ function mapStateToProps(state) {
return { showStore: state.showStore };
}
const mapDispatchToProps = (dispatch) =>
bindActionCreators(actionCreators, dispatch)
bindActionCreators({ selectShow, addShowToWishlist,
deleteFromWishlist, getShowDetails }, dispatch)
class ShowList extends React.Component {
componentWillMount() {
if (this.props.showsUrl) {
this.props.fetchShows(this.props.showsUrl);
return
}
}
render() {
const shows = this.props.showStore.shows;
const selectedShowId = this.props.showStore.selectedImdbId;
@ -37,9 +33,7 @@ class ShowList extends React.Component {
formModel="showStore"
filterControlModel="showStore.filter"
filterControlPlaceHolder="Filter shows..."
fetchExploreOptions={this.props.getShowExploreOptions}
exploreOptions={this.props.showStore.exploreOptions}
explore={this.props.exploreShows}
selectedImdbId={selectedShowId}
filter={this.props.showStore.filter}
perPage={this.props.showStore.perPage}