diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-11-30 13:56:22 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-12-06 12:38:19 +0100 |
| commit | d15b60581c94ef23ca4d29edfadbdfc7f436306e (patch) | |
| tree | 680ea3028649377d8aaba7648d5ab8bbcbdd62dd /app/containers | |
| parent | bcf5c6718701f5bac30c8c53319eaaab77c27e90 (diff) | |
| download | mullvadvpn-d15b60581c94ef23ca4d29edfadbdfc7f436306e.tar.xz mullvadvpn-d15b60581c94ef23ca4d29edfadbdfc7f436306e.zip | |
Enable flow for SelectLocationPage
Diffstat (limited to 'app/containers')
| -rw-r--r-- | app/containers/SelectLocationPage.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js index c39f76eba7..ae06ec7fd6 100644 --- a/app/containers/SelectLocationPage.js +++ b/app/containers/SelectLocationPage.js @@ -1,27 +1,33 @@ // @flow import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; import SelectLocation from '../components/SelectLocation'; import RelaySettingsBuilder from '../lib/relay-settings-builder'; import log from 'electron-log'; -import type { ReduxDispatch } from '../redux/store'; +import type { ReduxState, ReduxDispatch } from '../redux/store'; +import type { SharedRouteProps } from '../routes'; -const mapStateToProps = (state) => state; -const mapDispatchToProps = (dispatch: ReduxDispatch, props) => { +const mapStateToProps = (state: ReduxState) => state; +const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => { + const { push: pushHistory } = bindActionCreators({ push }, dispatch); const { backend } = props; return { - onClose: () => dispatch(push('/connect')), + onClose: () => pushHistory('/connect'), onSelect: async (relayLocation) => { try { - const relayUpdate = RelaySettingsBuilder.normal().location.fromRaw(relayLocation).build(); + const relayUpdate = RelaySettingsBuilder.normal() + .location + .fromRaw(relayLocation) + .build(); await backend.updateRelaySettings(relayUpdate); await backend.fetchRelaySettings(); await backend.connect(); - dispatch(push('/connect')); + pushHistory('/connect'); } catch (e) { log.error('Failed to select server: ', e.message); } |
