strapi-plugin-config-sync/admin/src/state/reducers/Config/index.js

26 lines
619 B
JavaScript
Raw Normal View History

2021-03-20 00:54:18 +01:00
/**
*
* Main reducer
*
*/
import { fromJS, Map } from 'immutable';
import { SET_DATABASE_CONFIG_IN_STATE, SET_FILE_CONFIG_IN_STATE } from '../../actions/Config';
2021-03-20 00:54:18 +01:00
const initialState = fromJS({
databaseConfig: Map({}),
fileConfig: Map({})
});
2021-03-20 00:54:18 +01:00
export default function configReducer(state = initialState, action) {
switch (action.type) {
case SET_DATABASE_CONFIG_IN_STATE:
return state
.update('databaseConfig', () => fromJS(action.config))
case SET_FILE_CONFIG_IN_STATE:
return state
.update('fileConfig', () => fromJS(action.config))
2021-03-20 00:54:18 +01:00
default:
return state;
}
}