2017-07-06 10:02:00 +02:00
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* App reducer
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2017-07-12 15:57:15 +02:00
|
|
|
import { fromJS, List } from 'immutable';
|
|
|
|
|
import {
|
|
|
|
|
MENU_FETCH_SUCCEEDED,
|
|
|
|
|
} from './constants';
|
2017-07-06 10:02:00 +02:00
|
|
|
|
2017-07-12 15:57:15 +02:00
|
|
|
const initialState = fromJS({
|
2017-07-13 13:55:03 +02:00
|
|
|
sections: List(), // eslint-disable-line new-cap
|
2017-07-12 15:57:15 +02:00
|
|
|
});
|
2017-07-06 10:02:00 +02:00
|
|
|
|
|
|
|
|
function appReducer(state = initialState, action) {
|
|
|
|
|
switch (action.type) {
|
2017-07-12 15:57:15 +02:00
|
|
|
case MENU_FETCH_SUCCEEDED:
|
2017-07-13 13:55:03 +02:00
|
|
|
return state.set('sections', List(action.menu.sections)); // eslint-disable-line new-cap
|
2017-07-06 10:02:00 +02:00
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default appReducer;
|