diff options
| -rw-r--r-- | app/containers/ConnectPage.js | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/app/containers/ConnectPage.js b/app/containers/ConnectPage.js index 9f2df48df4..ca64c6725a 100644 --- a/app/containers/ConnectPage.js +++ b/app/containers/ConnectPage.js @@ -1,3 +1,5 @@ +// @flow + import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; @@ -6,7 +8,10 @@ import { links } from '../config'; import Connect from '../components/Connect'; import connectActions from '../redux/connection/actions'; -const mapStateToProps = (state) => { +import type { ReduxState, ReduxDispatch } from '../redux/store'; +import type { SharedRouteProps } from '../routes'; + +const mapStateToProps = (state: ReduxState) => { return { accountExpiry: state.account.expiry, connection: state.connection, @@ -14,16 +19,27 @@ const mapStateToProps = (state) => { }; }; -const mapDispatchToProps = (dispatch, props) => { +const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => { const { connect, disconnect, copyIPAddress } = bindActionCreators(connectActions, dispatch); + const { push: pushHistory } = bindActionCreators({ push }, dispatch); const { backend } = props; return { - onSettings: () => dispatch(push('/settings')), - onSelectLocation: () => dispatch(push('/select-location')), - onConnect: () => connect(backend), - onCopyIP: () => copyIPAddress(), - onDisconnect: () => disconnect(backend), + onSettings: () => { + pushHistory('/settings'); + }, + onSelectLocation: () => { + pushHistory('/select-location'); + }, + onConnect: () => { + connect(backend); + }, + onCopyIP: () => { + copyIPAddress(); + }, + onDisconnect: () => { + disconnect(backend); + }, onExternalLink: (type) => shell.openExternal(links[type]), getServerInfo: (relayLocation) => backend.serverInfo(relayLocation), }; |
