2016-08-15 23:06:12 +02:00
|
|
|
import * as ActionTypes from '../../../constants';
|
|
|
|
|
|
|
|
const sketches = (state = [], action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.SET_PROJECTS:
|
|
|
|
return action.projects;
|
2016-10-12 20:24:53 +02:00
|
|
|
case ActionTypes.DELETE_PROJECT:
|
|
|
|
return state.filter((sketch) =>
|
|
|
|
sketch.id !== action.id
|
|
|
|
);
|
2016-08-15 23:06:12 +02:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default sketches;
|