diff -r 34a75bd8d0b9 -r d48946d164c6 client/src/actions/notesActions.js --- a/client/src/actions/notesActions.js Tue Jul 25 19:11:26 2017 +0200 +++ b/client/src/actions/notesActions.js Fri Jul 28 19:40:35 2017 +0200 @@ -1,7 +1,8 @@ import uuidV1 from 'uuid/v1'; import * as types from '../constants/actionTypes'; -import WebAnnotationSerializer from '../api/WebAnnotationSerializer'; +// import WebAnnotationSerializer from '../api/WebAnnotationSerializer'; +import { ActionEnum } from '../constants'; export const addNote = (session, data) => { const noteId = uuidV1(); @@ -15,34 +16,12 @@ finishedAt: data.finishedAt, categories: data.categories, marginComment: data.marginComment, + action: ActionEnum.CREATED }; - const noteSrvr = { - ext_id: noteId, - session: session._id, - raw: JSON.stringify(data.raw), - plain: data.plain, - html: data.html, - tc_start: data.startedAt, - tc_end: data.finishedAt, - categorization: WebAnnotationSerializer.serialize(note), - margin_note: data.marginComment, - } - return { type: types.ADD_NOTE, note, - meta: { - offline: { - effect: { - url: `/api/notes/sessions/${session.get('_id')}/notes/`, - method: 'POST', - data: noteSrvr - }, - commit: { type: types.NOOP }, - rollback: { type: types.NOOP } - } - } }; } @@ -50,42 +29,27 @@ return { type: types.DELETE_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: WebAnnotationSerializer.serialize(note), - margin_note: data.marginComment, - } return { type: types.UPDATE_NOTE, note, 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 } - } - } }; } + +export const doDeleteNote = (noteId) => { + return { type: types.DO_DELETE_NOTE, noteId }; +} + +export const loadNote = (note) => { + return { type: types.LOAD_NOTE, note }; +} + +export const resetActionNote = (note) => { + return { type: types.RESET_ACTION_NOTE, note }; +} +