mirror of
https://github.com/WenPai-org/wpmind.git
synced 2025-08-03 02:48:41 +08:00
changed settings API and page to React + rest changed structure of scripts - different folders for editor and admin scripts
37 lines
569 B
JavaScript
37 lines
569 B
JavaScript
const { settings } = window.mindAdminData;
|
|
|
|
function reducer(
|
|
state = {
|
|
settings,
|
|
updating: false,
|
|
error: '',
|
|
},
|
|
action = {}
|
|
) {
|
|
switch (action.type) {
|
|
case 'UPDATE_SETTINGS_PENDING':
|
|
return {
|
|
...state,
|
|
updating: true,
|
|
};
|
|
case 'UPDATE_SETTINGS_SUCCESS':
|
|
return {
|
|
...state,
|
|
updating: false,
|
|
settings: {
|
|
...state.settings,
|
|
...action.settings,
|
|
},
|
|
};
|
|
case 'UPDATE_SETTINGS_ERROR':
|
|
return {
|
|
...state,
|
|
updating: false,
|
|
error: action.error || '',
|
|
};
|
|
}
|
|
|
|
return state;
|
|
}
|
|
|
|
export default reducer;
|