client/src/reducers/notesReducer.js
changeset 109 ef62de545a8d
parent 96 b58463d7dc8e
child 124 c77570164050
--- a/client/src/reducers/notesReducer.js	Thu Jun 29 17:11:56 2017 +0200
+++ b/client/src/reducers/notesReducer.js	Thu Jun 29 17:26:35 2017 +0200
@@ -20,11 +20,10 @@
     case types.UPDATE_NOTE:
       const index = findNoteIndex(state, action.note.get('_id'));
       const note = findNote(state, action.note.get('_id'));
-      const newNote = note
-        .set('plain', action.data.plain)
-        .set('raw', action.data.raw)
-        .set('html', action.data.html)
-        .set('categories', action.data.categories);
+      let newNote = note;
+      Object.entries(action.data).forEach(([key, value]) => {
+        newNote = note.set(key, value)
+      });
       return state.set(index, newNote);
     case types.DELETE_SESSION:
       return state.filter((note) => action.session.get('_id') !== note.session)