client/src/actions/sessionsActions.js
author ymh <ymh.work@gmail.com>
Tue, 20 Jun 2017 19:05:01 +0200
changeset 66 f402435be429
parent 62 b2514a9bcd49
child 68 6e18b31b0ad5
permissions -rw-r--r--
Action types cleaning

//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
  }
}