diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-06-03 17:11:23 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-06-03 18:38:25 -0700 |
commit | d6fcd7e06d24ce75a17b82290ce54a802bc5e868 (patch) | |
tree | 0e97b9c4af2776e374afce8d01109fa8b15beb39 /web/src/js/ducks/eventLog.js | |
parent | 46d9cdd70a80fb1164cfb8c9a715a98b48c84b75 (diff) | |
download | mitmproxy-d6fcd7e06d24ce75a17b82290ce54a802bc5e868.tar.gz mitmproxy-d6fcd7e06d24ce75a17b82290ce54a802bc5e868.tar.bz2 mitmproxy-d6fcd7e06d24ce75a17b82290ce54a802bc5e868.zip |
web: implement redux store fetching
Diffstat (limited to 'web/src/js/ducks/eventLog.js')
-rw-r--r-- | web/src/js/ducks/eventLog.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js index 2040711c..081a2276 100644 --- a/web/src/js/ducks/eventLog.js +++ b/web/src/js/ducks/eventLog.js @@ -1,8 +1,17 @@ -import getList, {ADD} from "./list" +import makeList, {ADD} from "./utils/list" + const TOGGLE_FILTER = 'TOGGLE_EVENTLOG_FILTER' const TOGGLE_VISIBILITY = 'TOGGLE_EVENTLOG_VISIBILITY' -const UPDATE_LIST = "UPDATE_EVENTLOG" +export const UPDATE_LOG = "UPDATE_EVENTLOG" + +const { + reduceList, + addToList, + updateList, + fetchList, +} = makeList(UPDATE_LOG, "/events"); +export {updateList as updateLogEntries, fetchList as fetchLogEntries} const defaultState = { visible: false, @@ -11,7 +20,7 @@ const defaultState = { "info": true, "web": true }, - events: getList(), + events: reduceList(), filteredEvents: [], } @@ -32,8 +41,8 @@ export default function reducer(state = defaultState, action) { ...state, visible: !state.visible } - case UPDATE_LIST: - const events = getList(state.events, action) + case UPDATE_LOG: + const events = reduceList(state.events, action) return { ...state, events, @@ -53,9 +62,9 @@ export function toggleEventLogVisibility() { } let id = 0; export function addLogEntry(message, level = "web") { - return { - type: UPDATE_LIST, - cmd: ADD, - data: {message, level, id: `log-${id++}`} - } + return addToList({ + message, + level, + id: `log-${id++}` + }) }
\ No newline at end of file |