summaryrefslogtreecommitdiffhomepage
path: root/app/containers/ConnectPage.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-11-30 13:57:07 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-12-06 12:38:19 +0100
commit40b209cf695fa01eb562dc9db8a8a0069ee0794e (patch)
tree418e449a3de8a063cf8c0b7dddd6b6eb02ed54c6 /app/containers/ConnectPage.js
parent692fe4a6c6a5fdef65e7315e51bd2c22cffec1e9 (diff)
downloadmullvadvpn-40b209cf695fa01eb562dc9db8a8a0069ee0794e.tar.xz
mullvadvpn-40b209cf695fa01eb562dc9db8a8a0069ee0794e.zip
Enable flow for ConnectPage
Diffstat (limited to 'app/containers/ConnectPage.js')
-rw-r--r--app/containers/ConnectPage.js30
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),
};