cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
29 lines (27 loc) • 1.07 kB
JavaScript
const constants = require( '../constants' );
const initialState = {
genericLastDocuments: [],
isFetchingGenericDocuments: false,
isFakeGenericDocuments: false,
nextPageNumber: 1
};
module.exports = function update( state = initialState, action = {} ) {
switch( action.type ) {
case constants.document.RECEIVE_GENERIC_LAST_DOCUMENTS:
return Object.assign( {}, {
genericLastDocuments: state.genericLastDocuments.concat( action.data.documents ),
isFetchingGenericDocuments: false,
isFakeGenericDocuments: action.data.isFake,
nextPageNumber: action.data.nextPage
} );
case constants.document.REQUEST_GENERIC_LAST_DOCUMENTS:
return Object.assign( {}, {
genericLastDocuments: state.genericLastDocuments,
isFetchingGenericDocuments: true,
isFakeGenericDocuments: false,
nextPageNumber: state.nextPageNumber
} );
default :
return state;
}
};