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
556 B

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