client/src/actions/notesActions.js
changeset 83 76a4e4b11762
parent 80 b3a02ea6d097
child 86 fa8ef84a1780
--- a/client/src/actions/notesActions.js	Fri Jun 23 15:57:35 2017 +0200
+++ b/client/src/actions/notesActions.js	Fri Jun 23 17:58:21 2017 +0200
@@ -47,14 +47,42 @@
 export const deleteNote = (note) => {
   return {
     type: types.DELETE_NOTE,
-    note
+    note,
+    meta: {
+      offline: {
+        effect: {
+          url: `/api/notes/sessions/${note.get('session')}/notes/${note.get('_id')}/`,
+          method: 'DELETE'
+        },
+        commit: { type: types.NOOP },
+        rollback: { type: types.NOOP }
+      }
+    }
   };
 }
 
 export const updateNote = (note, data) => {
+  const noteSrvr = {
+    raw: JSON.stringify(data.raw),
+    plain: data.plain,
+    html: data.html,
+    categorization: JSON.stringify(data.categories),
+  }
+
   return {
     type: types.UPDATE_NOTE,
     note,
-    data
+    data,
+    meta: {
+      offline: {
+        effect: {
+          url: `/api/notes/sessions/${note.get('session')}/notes/${note.get('_id')}/`,
+          method: 'PUT',
+          data: noteSrvr
+        },
+        commit: { type: types.NOOP },
+        rollback: { type: types.NOOP }
+      }
+    }
   };
 }