diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-11-20 15:25:51 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-11-23 12:41:13 +0100 |
| commit | 18b070df8a556fa00debdc14f101a1d8a92e6838 (patch) | |
| tree | 268781367a6c83542d775220927db5db78e20050 /app/containers | |
| parent | afe2368eed8e4f083e0a1a361690b68cb0b12702 (diff) | |
| download | mullvadvpn-18b070df8a556fa00debdc14f101a1d8a92e6838.tar.xz mullvadvpn-18b070df8a556fa00debdc14f101a1d8a92e6838.zip | |
Fix backend.connect() call
Diffstat (limited to 'app/containers')
| -rw-r--r-- | app/containers/SelectLocationPage.js | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js index 82954349e4..5550fa7fc8 100644 --- a/app/containers/SelectLocationPage.js +++ b/app/containers/SelectLocationPage.js @@ -9,26 +9,14 @@ const mapDispatchToProps = (dispatch, props) => { const { backend } = props; return { onClose: () => dispatch(push('/connect')), - onSelect: (preferredServer) => { - - dispatch(push('/connect')); - - // add delay to let the map load - setTimeout(() => { - const update = { - host: { only: preferredServer }, - tunnel: { openvpn: { - }}, - }; - - backend.updateRelaySettings(update) - .then( () => dispatch(settingsActions.updateRelay({ - host: preferredServer, - }))) - .then( () => backend.connect()) - .catch( e => log.error('Failed updating relay constraints', e.message)); - - }, 600); + onSelect: async (host) => { + try { + await backend.connect(host); + dispatch(settingsActions.updateRelay({ host: host })); + dispatch(push('/connect')); + } catch (e) { + log.error('Failed to select server: ', e.message); + } } }; }; |
