This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2016-08-24 17:56:44 +02:00
|
|
|
import { SET_TIMELINE, ADD_STATUS } from '../actions/statuses';
|
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
|
|
|
const initialState = Immutable.Map();
|
|
|
|
|
|
|
|
export default function statuses(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case SET_TIMELINE:
|
|
|
|
return state.set(action.timeline, Immutable.fromJS(action.statuses));
|
|
|
|
case ADD_STATUS:
|
|
|
|
return state.update(action.timeline, function (list) {
|
2016-08-24 23:33:46 +02:00
|
|
|
return list.unshift(Immutable.fromJS(action.status));
|
2016-08-24 17:56:44 +02:00
|
|
|
});
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|