blob: d4fdf92b3af4d3a2e2e1e2bdbd4127e7def826c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// @flow
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { push } from 'react-router-redux';
import Account from '../components/Account';
import accountActions from '../redux/account/actions';
import { links } from '../config';
import { openLink } from '../lib/platform';
import type { ReduxState, ReduxDispatch } from '../redux/store';
import type { SharedRouteProps } from '../routes';
const mapStateToProps = (state: ReduxState) => state;
const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => {
const { push: pushHistory } = bindActionCreators({ push }, dispatch);
const { logout } = bindActionCreators(accountActions, dispatch);
return {
onLogout: () => {
logout(props.backend);
},
onClose: () => {
pushHistory('/settings');
},
onBuyMore: () => openLink(links['purchase'])
};
};
export default connect(mapStateToProps, mapDispatchToProps)(Account);
|