UNPKG

cluedin-widget

Version:

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

26 lines (24 loc) 903 B
const constants = require( '../constants' ); const initialState = { genericLastDocuments: [], isFetchingGenericDocuments: false, isFakeGenericDocuments: false }; module.exports = function update( state = initialState, action = {} ) { switch( action.type ) { case constants.document.RECEIVE_GENERIC_LAST_DOCUMENTS: return Object.assign( {}, { genericLastDocuments: action.data.documents, isFetchingGenericDocuments: false, isFakeGenericDocuments: action.data.isFake } ); case constants.document.REQUEST_GENERIC_LAST_DOCUMENTS: return Object.assign( {}, { genericLastDocuments: state.genericLastDocuments, isFetchingGenericDocuments: true, isFakeGenericDocuments: false } ); default : return state; } };