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.
44 lines (39 loc) • 1.27 kB
JavaScript
import constants from '../constants';
const initialState = {
isFetchingGetAskForLead: false,
isFetchingAskForLead: false,
invalidAskForLead: [],
askForLeads: void 0,
};
export default function update(state = initialState, action = {}) {
switch (action.type) {
case constants.askForLead.REQUEST_ASK_FOR_LEAD:
return Object.assign({}, state, {
isFetchingAskForLead: true,
invalidAskForLead: false,
});
case constants.askForLead.RECEIVE_ASK_FOR_LEAD:
let newAskForLeads = [...state.askForLeads, action.data.askForLead];
return Object.assign({}, state, {
isFetchingAskForLead: false,
invalidAskForLead: false,
askForLeads: newAskForLeads,
});
case constants.askForLead.INVALID_ASK_FOR_LEAD:
return Object.assign({}, state, {
isFetchingAskForLead: false,
invalidAskForLead: true,
});
case constants.askForLead.REQUEST_GET_ASK_FOR_LEAD:
return Object.assign({}, state, {
isFetchingAskForLead: true
});
case constants.askForLead.RECEIVE_GET_ASK_FOR_LEAD:
return Object.assign({}, state, {
isFetchingAskForLead: false,
askForLeads: action.data.askForLeads,
});
default :
return state;
}
}