| author | Alexandre Segura <mex.zktk@gmail.com> |
| Fri, 23 Jun 2017 10:16:49 +0200 | |
| changeset 79 | 772b73e31069 |
| parent 66 | f402435be429 |
| child 80 | b3a02ea6d097 |
| permissions | -rw-r--r-- |
import Immutable from 'immutable'; import * as types from '../constants/actionTypes'; import NoteRecord from '../store/noteRecord'; export default (state = Immutable.List([]), action) => { switch (action.type) { case types.ADD_NOTE: return state.push(new NoteRecord(action.note)); case types.DELETE_NOTE: const noteIndex = state.findIndex((note) => note.get('_id') === action.note.get('_id')); return state.delete(noteIndex); default: return state; } };