summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-07-27 15:06:35 +0200
committerErik Larkö <erik@mullvad.net>2017-08-08 09:50:58 +0200
commit9696131150239b8dabbff0eb2fcd3256cbc762c8 (patch)
treead3d00bd6693b857950e06221d6d20cc7a98f191 /app
parente516d327f01dc2b0969657228257b2cac7942ad3 (diff)
downloadmullvadvpn-9696131150239b8dabbff0eb2fcd3256cbc762c8.tar.xz
mullvadvpn-9696131150239b8dabbff0eb2fcd3256cbc762c8.zip
Add DISCONNECTED action
Diffstat (limited to 'app')
-rw-r--r--app/lib/backend.js4
-rw-r--r--app/redux/connection/actions.js14
-rw-r--r--app/redux/connection/reducers.js2
3 files changed, 15 insertions, 5 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index bd0ca7ab63..02ab2717f0 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -238,9 +238,7 @@ export class Backend {
})
.catch(e => {
log.info('Failed connecting to', addr, e);
- this._store.dispatch(connectionActions.connectionChange({
- status: 'disconnected',
- }));
+ this._store.dispatch(connectionActions.disconnected());
});
}
diff --git a/app/redux/connection/actions.js b/app/redux/connection/actions.js
index 7c808c8753..e334cfd63b 100644
--- a/app/redux/connection/actions.js
+++ b/app/redux/connection/actions.js
@@ -24,6 +24,9 @@ type ConnectingAction = {
type: 'CONNECTING',
serverAddress: string,
};
+type DisconnectedAction = {
+ type: 'DISCONNECTED',
+};
type ConnectionChangeAction = {
type: 'CONNECTION_CHANGE',
@@ -46,7 +49,7 @@ type NewLocationAction = {
newLocation: Location,
};
-export type ConnectionAction = ConnectionChangeAction | NewPublicIpAction | NewLocationAction | ConnectingAction;
+export type ConnectionAction = ConnectionChangeAction | NewPublicIpAction | NewLocationAction | ConnectingAction | DisconnectedAction;
function connectingTo(serverAddress: string): ConnectingAction {
return {
@@ -55,6 +58,12 @@ function connectingTo(serverAddress: string): ConnectingAction {
};
}
+function disconnected(): DisconnectedAction {
+ return {
+ type: 'DISCONNECTED',
+ };
+}
+
function connectionChange(newData: $Shape<ConnectionReduxState>): ConnectionChangeAction {
return {
type: 'CONNECTION_CHANGE',
@@ -77,4 +86,5 @@ function newLocation(newLoc: Location): NewLocationAction {
}
-export default { connect, disconnect, copyIPAddress, connectionChange, newPublicIp, newLocation, connectingTo };
+export default { connect, disconnect, copyIPAddress, connectionChange, newPublicIp, newLocation, connectingTo, disconnected };
+
diff --git a/app/redux/connection/reducers.js b/app/redux/connection/reducers.js
index 3c98ea2e4e..d454e1bc4a 100644
--- a/app/redux/connection/reducers.js
+++ b/app/redux/connection/reducers.js
@@ -39,6 +39,8 @@ export default function(state: ConnectionReduxState = initialState, action: Redu
status: 'connecting',
serverAddress: action.serverAddress,
}};
+ case 'DISCONNECTED':
+ return { ...state, ...{ status: 'disconnected' }};
default:
return state;
}