import { currentViewActionTypes } from "./action"; const currentViewInitialState = { currentView: {}, caseReference: {}, representationCapacity: {}, representationSubmit: "", representationSubmitConfirmation: {}, representationMessageSent: false, linkedCaseReferences: {}, currentPage: 1, showReps: false, showLogin: false, }; export default function reducer(state = currentViewInitialState, action) { switch (action.type) { case currentViewActionTypes.SETCURRENTVIEW: return { ...state, currentView: action.currentView, }; case currentViewActionTypes.SETCURRENTREFERENCE: return { ...state, caseReference: action.caseReference, }; case currentViewActionTypes.SETCURRENTLINKEDCASES: return { ...state, linkedCaseReferences: action.linkedCaseReferences, }; case currentViewActionTypes.SETREPRESENTATIONCAPACITY: return { ...state, representationCapacity: action.representationCapacity, }; case currentViewActionTypes.SETREPRESENTATIONSUBMIT: return { ...state, representationSubmit: action.representationSubmit, }; case currentViewActionTypes.SETREPRESENTATIONSUBMITCONFIRMATION: return { ...state, representationSubmitConfirmation: action.representationSubmitConfirmation, }; case currentViewActionTypes.SETREPRESENTATIONMESSAGESENT: return { ...state, representationMessageSent: action.representationMessageSent, }; case currentViewActionTypes.SETREPRESENTATIONRESET: return { ...state, representationCapacity: {}, representationSubmit: "", representationSubmitConfirmation: {}, representationMessageSent: false, }; case currentViewActionTypes.SETCURRENTPAGE: return { ...state, currentPage: action.currentPage, }; case currentViewActionTypes.SETSHOWREPS: return { ...state, showReps: action.showReps, showLogin: action.showLogin, }; default: return state; } }