File size: 687 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 NewsFeedIndex from './news_feed_index';
import { fetchUser,fetchAllUsers } from '../../actions/session_actions';
import { fetchNewsFeed, deletePost } from '../../actions/post_actions';
const mapStateToProps = (state,ownProps) => {
let currentUserId = state.session.id;
return {
posts: Object.values(state.entities.posts),
currentUser:state.entities.users[currentUserId],
users:state.entities.users
};
};
const mapDispatchToProps = dispatch => ({
fetchNewsFeed: ()=>dispatch(fetchNewsFeed()),
deletePost: id => dispatch(deletePost(id)),
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(NewsFeedIndex);
|