client/src/reducers/notesReducer.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 01 Jun 2017 11:39:20 +0200
changeset 13 d6eef0e9f7e1
parent 12 48ddaa42b810
child 29 4cfeabef7d5e
permissions -rw-r--r--
Fix test.

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