62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
import { currentViewActionTypes } from "./action";
|
|
|
|
const currentViewInitialState = {
|
|
currentView: {},
|
|
caseReference: {},
|
|
representationCapacity: {},
|
|
representationSubmit: "",
|
|
representationSubmitConfirmation: {},
|
|
linkedCaseReferences: {},
|
|
currentPage: 1,
|
|
showReps: 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.SETCURRENTPAGE:
|
|
return {
|
|
...state,
|
|
currentPage: action.currentPage,
|
|
};
|
|
case currentViewActionTypes.SETSHOWREPS:
|
|
return {
|
|
...state,
|
|
showReps: action.showReps,
|
|
};
|
|
default:
|
|
return state;
|
|
}
|
|
}
|