diff options
author | Matthew Shao <me@matshao.com> | 2017-06-27 21:55:41 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-06-27 21:58:13 +0800 |
commit | 58af3a6ba4f57a792e56e79acb8b9c1c4c8c8841 (patch) | |
tree | 716c34fe5375d14eb090667e4ce7aca9316ca9b6 | |
parent | d58abc9200812a165cfc6c4f67ac2a713236d6ad (diff) | |
download | mitmproxy-58af3a6ba4f57a792e56e79acb8b9c1c4c8c8841.tar.gz mitmproxy-58af3a6ba4f57a792e56e79acb8b9c1c4c8c8841.tar.bz2 mitmproxy-58af3a6ba4f57a792e56e79acb8b9c1c4c8c8841.zip |
[web] Add js/ducks/ui/modal.js
-rw-r--r-- | web/src/js/ducks/ui/modal.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/web/src/js/ducks/ui/modal.js b/web/src/js/ducks/ui/modal.js new file mode 100644 index 00000000..aafddaf7 --- /dev/null +++ b/web/src/js/ducks/ui/modal.js @@ -0,0 +1,33 @@ +export const HIDE_MODAL = 'UI_HIDE_MODAL' +export const SET_ACTIVE_MODAL = 'UI_SET_ACTIVE_MODAL' + +const defaultState = { + activeModal: undefined, +} + +export default function reducer(state = defaultState, action){ + switch (action.type){ + + case SET_ACTIVE_MODAL: + return { + ...state, + activeModal: action.activeModal, + } + + case HIDE_MODAL: + return { + ...state, + activeModal: undefined + } + default: + return state + } +} + +export function setActiveModal(activeModal) { + return { type: SET_ACTIVE_MODAL, activeModal } +} + +export function hideModal(){ + return { type: HIDE_MODAL } +} |