Improved how user lists look, added follow button to them

This commit is contained in:
Eugen Rochko
2016-10-28 20:05:44 +02:00
parent 1c84d505c8
commit ac4f53a3a2
6 changed files with 118 additions and 32 deletions

View File

@@ -1,6 +1,10 @@
import { connect } from 'react-redux';
import { makeGetAccount } from '../../../selectors';
import Account from '../components/account';
import {
followAccount,
unfollowAccount
} from '../../../actions/accounts';
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
@@ -14,7 +18,13 @@ const makeMapStateToProps = () => {
};
const mapDispatchToProps = (dispatch) => ({
//
onFollow (account) {
if (account.getIn(['relationship', 'following'])) {
dispatch(unfollowAccount(account.get('id')));
} else {
dispatch(followAccount(account.get('id')));
}
}
});
export default connect(makeMapStateToProps, mapDispatchToProps)(Account);