client/src/actions/notesActions.js
author ymh <ymh.work@gmail.com>
Tue, 20 Jun 2017 14:13:15 +0200
changeset 62 b2514a9bcd49
parent 59 1eb52770eefa
child 66 f402435be429
permissions -rw-r--r--
migrate to redux-offline + various optimisation

import uuidV1 from 'uuid/v1';

import * as types from '../constants/actionTypes';

export const addNote = (session, data) => {
  return {
    type: types.ADD_NOTE,
    note: {
      _id: uuidV1(),
      session: session._id,
      raw: data.raw,
      plain: data.plain,
      html: data.html,
      startedAt: data.startedAt,
      finishedAt: data.finishedAt,
      categories: data.categories,
    }
  };
}

export const loadNotesBySession = (session) => {
  return {
    type: types.LOAD_NOTES_BY_SESSION,
    session: session
  }
}