UNPKG

loop-modules

Version:

Shared modules for the Loop product suite.

21 lines (19 loc) 693 B
import { LoopActivityMessageState, initialState } from '../states/loop-activity-message.state'; import { Actions, ActionTypes } from '../actions/loop-activity-message.action'; export function reducer( state: LoopActivityMessageState = initialState, action: Actions ): LoopActivityMessageState { 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; } }