UNPKG

cluedin-widget

Version:

This is the project for creating and managing widgets in CluedIn.

26 lines (24 loc) 843 B
const constants = require( '../constants' ); const initialState = { genericLastDeals: [], isFetchingGenericDeals: false, isFakeGenericDeals: false }; module.exports = function update( state = initialState, action = {} ) { switch( action.type ) { case constants.deal.RECEIVE_GENERIC_LAST_DEALS: return Object.assign( {}, { genericLastDeals: action.data.deals, isFetchingGenericDeals: false, isFakeGenericDeals: action.data.isFake } ); case constants.deal.REQUEST_GENERIC_LAST_DEALS: return Object.assign( {}, { genericLastDeals: state.genericLastDeals, isFetchingGenericDeals: true, isFakeGenericDeals: false } ); default : return state; } };