You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
532 B

  1. import { SET_TIMELINE, ADD_STATUS } from '../actions/statuses';
  2. import Immutable from 'immutable';
  3. const initialState = Immutable.Map();
  4. export default function statuses(state = initialState, action) {
  5. switch(action.type) {
  6. case SET_TIMELINE:
  7. return state.set(action.timeline, Immutable.fromJS(action.statuses));
  8. case ADD_STATUS:
  9. return state.update(action.timeline, function (list) {
  10. list.unshift(Immutable.fromJS(action.status));
  11. });
  12. default:
  13. return state;
  14. }
  15. }