|
|
@@ -1,6 +1,6 @@
|
|
1
|
1
|
/* @flow */
|
|
2
|
2
|
|
|
3
|
|
-import { assign, ReducerRegistry, set } from '../redux';
|
|
|
3
|
+import { assign, ReducerRegistry } from '../redux';
|
|
4
|
4
|
import { parseURIString } from '../util';
|
|
5
|
5
|
|
|
6
|
6
|
import {
|
|
|
@@ -75,7 +75,9 @@ function _connectionEstablished(
|
|
75
|
75
|
{ connection }: { connection: Object }) {
|
|
76
|
76
|
return assign(state, {
|
|
77
|
77
|
connecting: undefined,
|
|
78
|
|
- connection
|
|
|
78
|
+ connection,
|
|
|
79
|
+ error: undefined,
|
|
|
80
|
+ errorMessage: undefined
|
|
79
|
81
|
});
|
|
80
|
82
|
}
|
|
81
|
83
|
|
|
|
@@ -91,14 +93,20 @@ function _connectionEstablished(
|
|
91
|
93
|
*/
|
|
92
|
94
|
function _connectionFailed(
|
|
93
|
95
|
state: Object,
|
|
94
|
|
- { connection }: { connection: Object }) {
|
|
|
96
|
+ { connection, error, message }: {
|
|
|
97
|
+ connection: Object,
|
|
|
98
|
+ error: string,
|
|
|
99
|
+ message: ?string
|
|
|
100
|
+ }) {
|
|
95
|
101
|
if (state.connection && state.connection !== connection) {
|
|
96
|
102
|
return state;
|
|
97
|
103
|
}
|
|
98
|
104
|
|
|
99
|
105
|
return assign(state, {
|
|
100
|
106
|
connecting: undefined,
|
|
101
|
|
- connection: undefined
|
|
|
107
|
+ connection: undefined,
|
|
|
108
|
+ error,
|
|
|
109
|
+ errorMessage: message
|
|
102
|
110
|
});
|
|
103
|
111
|
}
|
|
104
|
112
|
|
|
|
@@ -115,7 +123,11 @@ function _connectionFailed(
|
|
115
|
123
|
function _connectionWillConnect(
|
|
116
|
124
|
state: Object,
|
|
117
|
125
|
{ connection }: { connection: Object }) {
|
|
118
|
|
- return set(state, 'connecting', connection);
|
|
|
126
|
+ return assign(state, {
|
|
|
127
|
+ connecting: connection,
|
|
|
128
|
+ error: undefined,
|
|
|
129
|
+ errorMessage: undefined
|
|
|
130
|
+ });
|
|
119
|
131
|
}
|
|
120
|
132
|
|
|
121
|
133
|
/**
|