Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ...
- const mapDispatchToProps = dispatch => ({
- onFollow: username => dispatch({
- type: 'FOLLOW_USER',
- payload: agent.Profile.follow(username)
- }),
- onLoad: (payload) =>
- dispatch({ type: 'PROFILE_FAVORITES_PAGE_LOADED', payload }),
- onSetPage: (page, payload) => dispatch({ type: 'SET_PAGE', page, payload }),
- onUnfollow: username => dispatch({
- type: 'UNFOLLOW_USER',
- payload: agent.Profile.unfollow(username)
- }),
- onUnload: () =>
- dispatch({ type: 'PROFILE_FAVORITES_PAGE_UNLOADED' })
- });
- class ProfileFavorites extends Profile {
- // ...
- // override onSetPage from Profile: this version provides the favorited articles data.
- onSetPage(page) {
- const promise =
- agent.Articles.favoritedBy(this.props.profile.username, page);
- this.props.onSetPage(page, promise);
- }
- // ...
- }
- export default connect(mapStateToProps, mapDispatchToProps)(ProfileFavorites);
Advertisement
Add Comment
Please, Sign In to add comment