initial dynamic forms

This commit is contained in:
2021-07-08 16:22:12 +01:00
parent b335c11e6b
commit 878940a6d5
25 changed files with 709 additions and 60 deletions
+18
View File
@@ -0,0 +1,18 @@
export const appealTypeDataActionTypes = {
GETAPPEALTYPEDATA: "GETAPPEALTYPEDATA",
SETAPPEALTYPEDATA: "SETAPPEALTYPEDATA",
UPDATEAPPEALTYPEDATA: "UPDATEAPPEALTYPEDATA",
};
export const getAppealTypeObj = () => (dispatch) => {
return dispatch({
type: appealTypeDataActionTypes.GETAPPEALTYPEDATA,
});
};
export const setAppealType = (appealTypeData) => (dispatch) => {
return dispatch({
type: appealTypeDataActionTypes.SETAPPEALTYPEDATA,
appealType: appealTypeData,
});
};
+16
View File
@@ -0,0 +1,16 @@
import { appealTypeDataActionTypes } from "./action";
const appealTypeDataInitialState = {
appealType: {},
};
export default function reducer(state = appealTypeDataInitialState, action) {
switch (action.type) {
case appealTypeDataActionTypes.SETAPPEALTYPEDATA:
return {
appealType: action.appealType,
};
default:
return state;
}
}
+3 -1
View File
@@ -5,6 +5,7 @@ import progress from "./progress/reducer";
import search from "./search/reducer";
import searchResultsObj from "./searchOutput/reducer";
import formData from "./formData/reducer";
import appealType from "./appealType/reducer";
import { reducer as formReducer } from "redux-form";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
@@ -14,6 +15,7 @@ const combinedReducer = combineReducers({
search,
searchResultsObj,
formData,
appealType,
});
const reducer = (state = { progress: "{}" }, action) => {
@@ -74,7 +76,7 @@ const makeStore = ({ isServer }) => {
const persistConfig = {
key: "nextjs",
whitelist: ["progress,search,searchResults,formData"],
whitelist: ["progress,search,searchResults,formData,appealType"],
storage,
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
};