mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 02:57:19 +00:00
[web] Add js/ducks/ui/modal.js
This commit is contained in:
parent
d58abc9200
commit
58af3a6ba4
33
web/src/js/ducks/ui/modal.js
Normal file
33
web/src/js/ducks/ui/modal.js
Normal file
@ -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 }
|
||||
}
|
Loading…
Reference in New Issue
Block a user