File size: 666 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { connect } from 'react-redux';
import { requestUserByUrl, updatePhoto } from '../../actions/user_actions';
import Profile from './profile';
import { getUserFromUrl } from '../../reducers/selectors';

const mapStateToProps = (state, ownProps) => ({
  userUrl: ownProps.match.params.userUrl,
  user: getUserFromUrl(state, ownProps.match.params.userUrl),
  currentUserId: state.session.currentUserId
});

const mapDispatchToProps = dispatch => ({
  requestUserByUrl: url => dispatch(requestUserByUrl(url)),
  updatePhoto: (userId, photoData) => dispatch(updatePhoto(userId, photoData))
});

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