import { Actions , StatsState , State } from 'ngrx-domains' ; export function reducer ( state = State . stats , action ) { switch ( action . constructor ) { case Actions . stats . ResetStatsAction : return Object . assign ( { } , State . stats ) ; case Actions . books . SearchAction : return Object . assign ( { } , state , { query : action . payload } ) ; case Actions . books . SearchCompleteAction : return Object . assign ( { } , state , { searchHistory : [ ... state . searchHistory , state . query ] , searchCount : state . searchCount + 1 } ) ; default : return state ; } }