p5.js-web-editor/client/modules/IDE/reducers/projects.js

16 lines
358 B
JavaScript
Raw Normal View History

import * as ActionTypes from '../../../constants';
const sketches = (state = [], action) => {
switch (action.type) {
case ActionTypes.SET_PROJECTS:
return action.projects;
case ActionTypes.DELETE_PROJECT:
return state.filter(sketch =>
2018-05-05 00:22:39 +00:00
sketch.id !== action.id);
default:
return state;
}
};
export default sketches;