From ac4f53a3a2488c4af789df862d9e68d5327bebb1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 28 Oct 2016 20:05:44 +0200 Subject: Improved how user lists look, added follow button to them --- .../features/followers/containers/account_container.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/components/features/followers/containers/account_container.jsx') diff --git a/app/assets/javascripts/components/features/followers/containers/account_container.jsx b/app/assets/javascripts/components/features/followers/containers/account_container.jsx index ee6b6dcfd..988d60adb 100644 --- a/app/assets/javascripts/components/features/followers/containers/account_container.jsx +++ b/app/assets/javascripts/components/features/followers/containers/account_container.jsx @@ -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); -- cgit