about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/followers/containers/account_container.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-28 20:05:44 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-28 20:05:44 +0200
commitac4f53a3a2488c4af789df862d9e68d5327bebb1 (patch)
tree1c7f3da1dccd1eab021e0b34927a36b50634344c /app/assets/javascripts/components/features/followers/containers/account_container.jsx
parent1c84d505c8cb926710d059725c5a2d966dd4736b (diff)
Improved how user lists look, added follow button to them
Diffstat (limited to 'app/assets/javascripts/components/features/followers/containers/account_container.jsx')
-rw-r--r--app/assets/javascripts/components/features/followers/containers/account_container.jsx12
1 files changed, 11 insertions, 1 deletions
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);