Files
pedwfrontend/store/currentView/reducer.js
T

51 lines
1.5 KiB
JavaScript

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