File size: 635 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { connect } from 'react-redux';
import { updatePost } from '../../actions/post_actions';
import { hideModal } from '../../actions/ui_actions';
import PostForm from './post_form';

const mapStateToProps = (state, ownProps) => ({
  post: ownProps.post,
  formType: 'Edit Post',
  formButtonText: 'Save',
  author: state.entities.users[ownProps.post.authorId],
  recipient: state.entities.users[ownProps.post.recipientId]
});

const mapDispatchToProps = dispatch => ({
  action: post => dispatch(updatePost(post)),
  hideModal: () => dispatch(hideModal())
});

export default connect(mapStateToProps, mapDispatchToProps)(PostForm);