aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/websocket.js
blob: 3999dbcf1851723787c8dd3147f2a307f55433ff (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
const CONNECTED = 'WEBSOCKET_CONNECTED'
const DISCONNECTED = 'WEBSOCKET_DISCONNECTED'


const defaultState = {
    connected: true,
    /* 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}
}