]> cat aescling's git repositories - mastodon.git/blob
da1e5eaa14b18ada50450f1062378cfa0f341da4
[mastodon.git] /
1 import { connect } from 'react-redux';
2 import { makeGetAccount } from '../../../selectors';
3 import AccountAuthorize from '../components/account_authorize';
4 import { authorizeFollowRequest, rejectFollowRequest } from '../../../actions/accounts';
5
6 const makeMapStateToProps = () => {
7 const getAccount = makeGetAccount();
8
9 const mapStateToProps = (state, props) => ({
10 account: getAccount(state, props.id)
11 });
12
13 return mapStateToProps;
14 };
15
16 const mapDispatchToProps = (dispatch, { id }) => ({
17 onAuthorize (account) {
18 dispatch(authorizeFollowRequest(id));
19 },
20
21 onReject (account) {
22 dispatch(rejectFollowRequest(id));
23 }
24 });
25
26 export default connect(makeMapStateToProps, mapDispatchToProps)(AccountAuthorize);