blob: d4eb60803853dc0c7d5c8680890810179ef49610 (
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 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 { backend } = props;
const { push: pushHistory } = bindActionCreators({ push }, dispatch);
return {
onClose: () => pushHistory('/settings'),
onChangeAllowLan: (allowLan) => {
backend.setAllowLan(allowLan);
},
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Preferences);
|