diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-06-02 00:04:10 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-06-02 00:04:10 -0700 |
commit | 9e3591e3c225c51d5a5b80eb331719d20d14dc48 (patch) | |
tree | 137afcb2916a214b642db608aab240f761665433 /web/src/js/reducers/eventLog.js | |
parent | 9a76e31f2fb77367d6632b6b03cdfeabfadf0caf (diff) | |
download | mitmproxy-9e3591e3c225c51d5a5b80eb331719d20d14dc48.tar.gz mitmproxy-9e3591e3c225c51d5a5b80eb331719d20d14dc48.tar.bz2 mitmproxy-9e3591e3c225c51d5a5b80eb331719d20d14dc48.zip |
add basic redux architecture, convert eventlog to redux
Diffstat (limited to 'web/src/js/reducers/eventLog.js')
-rw-r--r-- | web/src/js/reducers/eventLog.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/web/src/js/reducers/eventLog.js b/web/src/js/reducers/eventLog.js new file mode 100644 index 00000000..169cd306 --- /dev/null +++ b/web/src/js/reducers/eventLog.js @@ -0,0 +1,30 @@ +import {combineReducers} from 'redux' +import {TOGGLE_EVENTLOG_FILTER} from "../reduxActions" + +const defaultVisibility = { + "debug": false, + "info": true, + "web": true +}; + +const visibilityFilter = (state = defaultVisibility, action) => { + switch (action.type) { + case TOGGLE_EVENTLOG_FILTER: + return Object.assign({}, state, { + [action.filter]: !state[action.filter] + }); + default: + return state; + } +}; + +const entries = (state = [], action) => { + return state; +}; + +const eventLog = combineReducers({ + visibilityFilter, + entries +}); + +export default eventLog |