2021-03-20 00:54:18 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Main reducer
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-11-20 19:06:01 +01:00
|
|
|
import { fromJS, Map, List } from 'immutable';
|
|
|
|
import { SET_CONFIG_DIFF_IN_STATE, SET_CONFIG_PARTIAL_DIFF_IN_STATE, SET_LOADING_STATE } from '../../actions/Config';
|
2021-03-20 00:54:18 +01:00
|
|
|
|
2021-03-20 03:20:48 +01:00
|
|
|
const initialState = fromJS({
|
2021-03-24 18:41:03 +01:00
|
|
|
configDiff: Map({}),
|
2021-11-20 19:06:01 +01:00
|
|
|
partialDiff: List([]),
|
2021-03-21 17:55:14 +01:00
|
|
|
isLoading: false,
|
2021-03-20 03:20:48 +01:00
|
|
|
});
|
2021-03-20 00:54:18 +01:00
|
|
|
|
|
|
|
export default function configReducer(state = initialState, action) {
|
|
|
|
switch (action.type) {
|
2021-03-24 18:41:03 +01:00
|
|
|
case SET_CONFIG_DIFF_IN_STATE:
|
2021-03-20 03:20:48 +01:00
|
|
|
return state
|
2021-11-20 19:06:01 +01:00
|
|
|
.update('configDiff', () => fromJS(action.config));
|
|
|
|
case SET_CONFIG_PARTIAL_DIFF_IN_STATE:
|
|
|
|
return state
|
|
|
|
.update('partialDiff', () => fromJS(action.config));
|
2021-03-21 17:55:14 +01:00
|
|
|
case SET_LOADING_STATE:
|
|
|
|
return state
|
2021-11-20 19:06:01 +01:00
|
|
|
.update('isLoading', () => fromJS(action.value));
|
2021-03-20 00:54:18 +01:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2021-11-20 19:06:01 +01:00
|
|
|
}
|