Files
pedwfrontend/store/currentView/reducer.js
T
2024-12-18 12:39:17 +00:00

92 lines
2.8 KiB
JavaScript

import { currentViewActionTypes } from "./action";
const currentViewInitialState = {
currentView: {},
caseReference: {},
representationCapacity: "",
representationSubmit: "",
representationSubmitConfirmation: false,
representationMessageSent: false,
linkedCaseReferences: {},
currentPage: 1,
showReps: false,
showLogin: false,
locale: "",
fileList: [],
};
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.SETFILELISTREPS:
return {
...state,
fileList: action.fileList,
};
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: false,
representationMessageSent: false,
};
case currentViewActionTypes.SETCURRENTPAGE:
return {
...state,
currentPage: action.currentPage,
};
case currentViewActionTypes.SETSHOWREPS:
return {
...state,
showReps: action.showReps,
showLogin: action.showLogin,
};
case currentViewActionTypes.SETLOCALE:
return {
...state,
locale: action.locale,
};
default:
return state;
}
}