in app/addons/config/reducers.js [96:172]
export default function config(state = initialState, action) {
const { options } = action;
switch (action.type) {
case ActionTypes.EDIT_CONFIG:
return {
...state,
sections: options.sections,
loading: false,
editOptionName: null,
editSectionName: null
};
case ActionTypes.EDIT_OPTION:
return {
...state,
editSectionName: options.sectionName,
editOptionName: options.optionName
};
case ActionTypes.LOADING_CONFIG:
return {
...state,
loading: true
};
case ActionTypes.CANCEL_EDIT:
return {
...state,
editOptionName: null,
editSectionName: null
};
case ActionTypes.SAVING_OPTION:
return {
...state,
saving: true
};
case ActionTypes.OPTION_SAVE_SUCCESS:
return {
...state,
editOptionName: null,
editSectionName: null,
sections: saveOption(state, options),
saving: false
};
case ActionTypes.OPTION_SAVE_FAILURE:
return {
...state,
saving: false
};
case ActionTypes.OPTION_ADD_SUCCESS:
return {
...state,
sections: saveOption(state, options),
saving: false
};
case ActionTypes.OPTION_ADD_FAILURE:
return {
...state,
saving: false
};
case ActionTypes.OPTION_DELETE_SUCCESS:
return {
...state,
sections: deleteOption(state, options)
};
default:
return state;
}
}