client/src/reducers/notesReducer.js
changeset 79 772b73e31069
parent 66 f402435be429
child 80 b3a02ea6d097
--- a/client/src/reducers/notesReducer.js	Thu Jun 22 12:37:53 2017 +0200
+++ b/client/src/reducers/notesReducer.js	Fri Jun 23 10:16:49 2017 +0200
@@ -6,6 +6,9 @@
   switch (action.type) {
     case types.ADD_NOTE:
       return state.push(new NoteRecord(action.note));
+    case types.DELETE_NOTE:
+      const noteIndex = state.findIndex((note) => note.get('_id') === action.note.get('_id'));
+      return state.delete(noteIndex);
     default:
       return state;
   }