blob: 824274c15cba014079bee8c159a5bc9f5f34e6c1 (
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
|
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { push } from 'react-router-redux';
import SelectLocation from '../components/SelectLocation';
import settingsActions from '../redux/settings/actions';
const mapStateToProps = (state) => state;
const mapDispatchToProps = (dispatch, props) => {
const { backend } = props;
const settings = bindActionCreators(settingsActions, dispatch);
return {
onClose: () => dispatch(push('/connect')),
onSelect: (preferredServer) => {
const server = backend.serverInfo(preferredServer);
dispatch(push('/connect'));
// add delay to let the map load
setTimeout(() => {
settings.updateSettings({ preferredServer });
backend.connect(server.address);
}, 600);
}
};
};
export default connect(mapStateToProps, mapDispatchToProps)(SelectLocation);
|