client/src/actions/sessionsActions.js
author ymh <ymh.work@gmail.com>
Tue, 20 Jun 2017 21:56:42 +0200
changeset 67 9206af01f5e5
parent 66 f402435be429
child 68 6e18b31b0ad5
permissions -rw-r--r--
Change to UserRecord

//import uuidV1 from 'uuid/v1';

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

export const createSession = (sessionId) => {

  //const sessionId = uuidV1();
  const newSession = {
      _id: sessionId,
      ext_id: sessionId,
      date: new Date(),
      title: '',
      description: '',
  };

  return {
    type: types.CREATE_SESSION,
    session: newSession,
    meta: {
      offline: {
        effect: {
          url: "/api/notes/sessions/",
          method: 'POST',
          data: newSession
        },
        commit: { type: types.NOOP },
        rollback: { type: types.NOOP }
      }
    }
  };
}

export const updateSession = (session, values) => {
  return {
    type: types.UPDATE_SESSION,
    session: session,
    values: values,
  };
}

export const loadSessions = () => {
  return {
    type: types.LOAD_SESSIONS
  }
}