UNPKG

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.

59 lines (53 loc) 1.75 kB
import constants from '../constants'; import { storage } from '../config'; const initialState = { boardingInfo: void 0, isFetching: false, allInvitations: void 0, isFetchingInvitations: false, state: {}, isSearchDone: storage.isSearchDone(), isEntityPageVisited: storage.isEntityPageVisited(), }; 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), }); case constants.boarding.RECEIVE_MARK_AS_SEARCHED: return Object.assign({}, state, { isSearchDone: true, }); case constants.boarding.RECEIVE_MARK_AS_VISITED: return Object.assign({}, state, { isEntityPageVisited: true, }); default : return state; } };