blob: 6ee813209ad4374c6dec2b91661f86e5822122f2 (
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
|
// @flow
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { push } from 'react-router-redux';
import Preferences from '../components/Preferences';
import type { ReduxState, ReduxDispatch } from '../redux/store';
import type { SharedRouteProps } from '../routes';
const mapStateToProps = (state: ReduxState) => ({
allowLan: state.settings.allowLan,
});
const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => {
const { push: pushHistory } = bindActionCreators({ push }, dispatch);
return {
onClose: () => pushHistory('/settings'),
onChangeAllowLan: (allowLan) => {
props.app.setAllowLan(allowLan);
},
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Preferences);
|