File size: 711 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 |
import { connect } from 'react-redux';
import Comments from './comments';
import { postComment, destroyComment } from '../../actions/comment_actions';
import { fetchPost } from '../../actions/post_actions';
const mapStateToProps = state => {
const currentUserId = state.session.id ;
return (
{currentUser: state.entities.users[currentUserId]});
};
const mapDispatchToProps = (dispatch) => {
return {
postComment: (postId, comment) => dispatch(postComment(postId, comment)),
fetchPost: (postId) => dispatch(fetchPost(postId)),
deleteComment: (postId,commentId) => dispatch(destroyComment(postId,commentId)),
};
};
export default connect(mapStateToProps,mapDispatchToProps)(Comments);
|