aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/websocket.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/ducks/websocket.js')
-rw-r--r--web/src/js/ducks/websocket.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/web/src/js/ducks/websocket.js b/web/src/js/ducks/websocket.js
new file mode 100644
index 00000000..3999dbcf
--- /dev/null
+++ b/web/src/js/ducks/websocket.js
@@ -0,0 +1,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}
+} \ No newline at end of file