2016-08-18 14:22:12 +02:00
|
|
|
import { fromJS } from 'immutable';
|
|
|
|
import {
|
2017-03-18 17:34:00 +01:00
|
|
|
UPDATE_PLUGIN,
|
2016-09-06 16:59:56 +02:00
|
|
|
PLUGIN_LOADED,
|
2016-08-18 14:22:12 +02:00
|
|
|
} from './constants';
|
|
|
|
|
|
|
|
const initialState = fromJS({
|
|
|
|
plugins: {},
|
|
|
|
});
|
|
|
|
|
|
|
|
function appReducer(state = initialState, action) {
|
|
|
|
switch (action.type) {
|
2016-09-06 16:59:56 +02:00
|
|
|
case PLUGIN_LOADED:
|
2017-03-18 17:34:00 +01:00
|
|
|
return state.setIn(['plugins', action.plugin.id], fromJS(action.plugin));
|
|
|
|
case UPDATE_PLUGIN:
|
|
|
|
return state.setIn(['plugins', action.pluginId, action.updatedKey], fromJS(action.updatedValue));
|
2016-08-18 14:22:12 +02:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default appReducer;
|