client/src/reducers/notesReducer.js
changeset 79 772b73e31069
parent 66 f402435be429
child 80 b3a02ea6d097
equal deleted inserted replaced
78:49c5ea36d0a4 79:772b73e31069
     4 
     4 
     5 export default (state = Immutable.List([]), action) => {
     5 export default (state = Immutable.List([]), action) => {
     6   switch (action.type) {
     6   switch (action.type) {
     7     case types.ADD_NOTE:
     7     case types.ADD_NOTE:
     8       return state.push(new NoteRecord(action.note));
     8       return state.push(new NoteRecord(action.note));
       
     9     case types.DELETE_NOTE:
       
    10       const noteIndex = state.findIndex((note) => note.get('_id') === action.note.get('_id'));
       
    11       return state.delete(noteIndex);
     9     default:
    12     default:
    10       return state;
    13       return state;
    11   }
    14   }
    12 };
    15 };