cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
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;
}
};