import { Order } from '../../core/model/order' ; import * as OrderActions from '../actions' ; export interface OrderState { orders : Order [ ] ; loading : boolean ; error : boolean ; } export const initialState = { orders : [ ] , loading : false , error : false } ; export function reducer ( state = initialState , action ) { switch ( action . type ) { case OrderActions . GET_ORDERS : { return { ... state , loading : true } ; } case OrderActions . GET_ORDERS_ERROR : { return { ... state , loading : false } ; } case OrderActions . GET_ORDERS_SUCCESS : { return { ... state , orders : action . payload , loading : false } ; } } }