client/src/reducers/notesReducer.js
author duong tam kien <tk@deveha.com>
Thu, 15 Jun 2017 16:51:24 +0200
changeset 41 aec51a27ca54
parent 29 4cfeabef7d5e
child 58 f16a080e0bc4
permissions -rw-r--r--
bootstrap of list of sessions

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.LOAD_NOTES_BY_SESSION:
      return action.notes;
    default:
      return state;
  }
};