client/src/reducers/notesReducer.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 08 Jun 2017 18:54:36 +0200
changeset 25 e04714a1d4eb
parent 12 48ddaa42b810
child 29 4cfeabef7d5e
permissions -rw-r--r--
Improve categories tooltip. - Manage categories with comment enabled. - Rename mark type to "category". - Simplify code, use only one mark type.

import Immutable from 'immutable';
// import PouchDB from 'pouchdb';

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

// const db = new PouchDB('notes');

// db.allDocs({ include_docs: true, descending: true }, function(err, doc) {
//   console.log(doc.rows)
// });

export default (state = Immutable.List([]), action) => {
  switch (action.type) {
    case types.ADD_NOTE:
      return state.push(new noteRecord(action.note));
    default:
      return state;
  }
};