cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
29 lines (27 loc) • 1.16 kB
JavaScript
const constants = require( '../constants' );
const initialState = {
genericLastOrganizations: [],
isFetchingGenericOrganizations: false,
isFakeGenericOrganization: false,
nextPageNumber: 1
};
module.exports = function update( state = initialState, action = {} ) {
switch( action.type ) {
case constants.organization.RECEIVE_GENERIC_LAST_ORGANIZATIONS:
return Object.assign( {}, {
genericLastOrganizations: state.genericLastOrganizations.concat( action.data.organizations ),
isFetchingGenericOrganizations: false,
isFakeGenericOrganization: action.data.fake,
nextPageNumber: action.data.nextPage
} );
case constants.organization.REQUEST_GENERIC_LAST_ORGANIZATIONS:
return Object.assign( {}, {
genericLastOrganizations: state.genericLastOrganizations,
isFetchingGenericOrganizations: true,
isFakeGenericOrganization: state.isFakeGenericOrganization,
nextPageNumber: state.nextPageNumber
} );
default :
return state;
}
};