2019-09-17 11:33:18 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
|
|
import { requestComments } from '../actions/requestComments';
|
|
|
|
|
|
|
|
|
|
import { State } from '../reducers/rootReducer';
|
|
|
|
|
|
|
|
|
|
import CommentsP from '../components/Comments/CommentsP';
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state: State) => ({
|
|
|
|
|
comments: state.currentPost.comments.items,
|
|
|
|
|
areLoading: state.currentPost.comments.areLoading,
|
|
|
|
|
error: state.currentPost.comments.error,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
2019-09-17 15:03:25 +02:00
|
|
|
requestComments(postId: number) {
|
|
|
|
|
dispatch(requestComments(postId));
|
2019-09-17 11:33:18 +02:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps,
|
|
|
|
|
)(CommentsP);
|