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.
48 lines (42 loc) • 1.35 kB
JavaScript
import constants from '../constants';
const initialState = {
boardingInfo: void 0,
isFetching: false,
allInvitations: void 0,
isFetchingInvitations: false,
state: {},
};
export default function update(state = initialState, action = {}) {
switch (action.type) {
case constants.boarding.REQUEST_BOARDING:
return Object.assign({}, state, {
isFetching: true,
});
case constants.boarding.RECEIVE_BOARDING:
return Object.assign({}, state, {
boardingInfo: action.data || {},
isFetching: false,
});
case constants.boarding.REQUEST_INVITATIONS:
return Object.assign({}, state, {
isFetchingInvitations: true,
});
case constants.boarding.RECEIVE_INVITATIONS:
return Object.assign({}, state, {
isFetchingInvitations: false,
allInvitations: action.data.invitations,
});
case constants.boarding.REQUEST_MARK_AS_SEARCHED:
state.boardingInfo.hasSearched = true;
return Object.assign({}, state, {
boardingInfo: Object.assign({}, state.boardingInfo),
});
case constants.boarding.REQUEST_MARK_AS_VISISTED:
state.boardingInfo.hasVisited = true;
return Object.assign({}, state, {
boardingInfo: Object.assign({}, state.boardingInfo),
});
default :
return state;
}
};