summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
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;
}