loop-modules
Version:
Shared modules for the Loop product suite.
21 lines (19 loc) • 689 B
text/typescript
import { LoopTrendingActivityState, initialState } from '../states/loop-trending-activity.state';
import { Actions, ActionTypes } from '../actions/loop-activity.action';
export function reducer(
state: LoopTrendingActivityState = initialState,
action: Actions
): LoopTrendingActivityState {
switch (action.type) {
case ActionTypes.QUERY:
return (<any>Object).assign({}, state, {
entries: [...state.entries, ...action.payload]
});
case ActionTypes.SET_ENTRIES:
return (<any>Object).assign({}, state, {
entries: action.payload
});
default:
return state;
}
}