blob: c10f9f5eb50e76dbd0a40db3aab3e150b54228ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const CONNECTED = 'WEBSOCKET_CONNECTED'
const DISCONNECTED = 'WEBSOCKET_DISCONNECTED'
export const CMD_ADD = 'add'
export const CMD_UPDATE = 'update'
export const CMD_REMOVE = 'remove'
export const CMD_RESET = 'reset'
const defaultState = {
connected: false,
/* we may want to have an error message attribute here at some point */
}
export default function reducer(state = defaultState, action) {
switch (action.type) {
case CONNECTED:
return {
connected: true
}
case DISCONNECTED:
return {
connected: false
}
default:
return state
}
}
export function connected() {
return {type: CONNECTED}
}
export function disconnected() {
return {type: DISCONNECTED}
}
|