aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/eventLog.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/ducks/eventLog.js')
-rw-r--r--web/src/js/ducks/eventLog.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js
new file mode 100644
index 00000000..5bae252a
--- /dev/null
+++ b/web/src/js/ducks/eventLog.js
@@ -0,0 +1,39 @@
+const TOGGLE_FILTER = 'TOGGLE_EVENTLOG_FILTER'
+const TOGGLE_VISIBILITY = 'TOGGLE_EVENTLOG_VISIBILITY'
+
+
+const defaultState = {
+ visible: false,
+ filter: {
+ "debug": false,
+ "info": true,
+ "web": true
+ }
+}
+export default function reducer(state = defaultState, action) {
+ switch (action.type) {
+ case TOGGLE_FILTER:
+ return {
+ ...state,
+ filter: {
+ ...state.filter,
+ [action.filter]: !state.filter[action.filter]
+ }
+ }
+ case TOGGLE_VISIBILITY:
+ return {
+ ...state,
+ visible: !state.visible
+ }
+ default:
+ return state
+ }
+}
+
+
+export function toggleEventLogFilter(filter) {
+ return {type: TOGGLE_FILTER, filter}
+}
+export function toggleEventLogVisibility() {
+ return {type: TOGGLE_VISIBILITY}
+} \ No newline at end of file