about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/followers/containers/account_container.jsx
diff options
context:
space:
mode:
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);