import _ from 'lodash' // https://lodash.com/docs/4.17.15 확인하자 라이브러리
import * as types from '../action/ActionTypes';
const initialState={
currentMenuName: '',
};
const menuListReducer = (state=initialState, action) => {
switch (action.type) {
case types.MENU_ALL_LIST:
return {
...state,
menuList: action.menuList
}
case types.MENU_HR_LIST:
return {
...state,
menuList: [_.mapKeys(action.menuList, 'menuCode').HR00]
}
case types.MENU_ACCOUNT_LIST:
return {
...state,
menuList: [_.mapKeys(action.menuList, 'menuCode').ACC00]
}
case types.MENU_LOGI_LIST:
return {
...state,
menuList: [_.mapKeys(action.menuList, 'menuCode').LOGI00]
}
default:
return state;
}
}
export default menuListReducer;
'IT_Web > React' 카테고리의 다른 글
React 이벤트 처리의 종류- onSelect, onKeyDown, onBlur, onClick, onChange (0) | 2020.06.25 |
---|---|
React 이벤트 처리 종류 (0) | 2020.03.09 |
React, Hooks로 react-redux(connect방법 및 사용방법) (0) | 2020.03.09 |
React PublicRoute & PrivateRoute 활용법 (0) | 2020.02.25 |
React redux-thunk 활용 및 연결방법 (0) | 2020.02.25 |