import { LoopUserState, initialState } from '../states/loop-user.state'; import { Actions, ActionTypes } from '../actions/loop-user.action'; export function reducer( state: LoopUserState = initialState, action: Actions ): LoopUserState { switch (action.type) { case ActionTypes.AUTH: return (Object).assign({}, state, { authUser: action.payload }); case ActionTypes.RESET_AUTH: return (Object).assign({}, state, { authUser: undefined }); case ActionTypes.ENTRIES: return (Object).assign({}, state, { entries: [...state.entries, ...action.payload] }); case ActionTypes.RESET_ENTRIES: return (Object).assign({}, state, { entries: [] }); case ActionTypes.TOGGLE_SELECTED: return (Object).assign({}, state, { }); case ActionTypes.RESET_SELECTED_ENTRIES: return (Object).assign({}, state, { selectedEntries: [] }); default: return state; } }