add mock api calls for modules viewall component

This commit is contained in:
2021-07-29 14:46:09 +01:00
parent 777df3f907
commit 2b14eaaf1f
30 changed files with 884 additions and 112 deletions
-2
View File
@@ -1,5 +1,3 @@
import { actionTypes } from "redux-form";
export const appealTypeDataActionTypes = {
GETAPPEALTYPEDATA: "GETAPPEALTYPEDATA",
SETAPPEALTYPEDATA: "SETAPPEALTYPEDATA",
+18
View File
@@ -0,0 +1,18 @@
export const awaitingSubmissionActionTypes = {
GETAWAITINGSUBMISSION: "GETAWAITINGSUBMISSION",
SETAWAITINGSUBMISSION: "SETAWAITINGSUBMISSION",
UPDATEAWAITINGSUBMISSION: "UPDATEAWAITINGSUBMISSION",
};
export const getAwaitingSubmissionObj = () => (dispatch) => {
return dispatch({
type: awaitingSubmissionActionTypes.GETAWAITINGSUBMISSION,
});
};
export const setAwaitingSubmission = (awaitingSubmission) => (dispatch) => {
return dispatch({
type: awaitingSubmissionActionTypes.SETAWAITINGSUBMISSION,
awaitingSubmission: awaitingSubmission,
});
};
+19
View File
@@ -0,0 +1,19 @@
import { awaitingSubmissionActionTypes } from "./action";
const awaitingSubmissionInitialState = {
awaitingSubmission: {},
};
export default function reducer(
state = awaitingSubmissionInitialState,
action
) {
switch (action.type) {
case awaitingSubmissionActionTypes.SETAWAITINGSUBMISSION:
return {
awaitingSubmission: action.awaitingSubmission,
};
default:
return state;
}
}
+17
View File
@@ -0,0 +1,17 @@
export const currentViewActionTypes = {
GETCURRENTVIEW: "GETCURRENTVIEW",
SETCURRENTVIEW: "SETCURRENTVIEW",
};
export const getCurrentViewObj = () => (dispatch) => {
return dispatch({
type: currentViewActionTypes.GETCURRENTVIEW,
});
};
export const setCurrentView = (currentView) => (dispatch) => {
return dispatch({
type: currentViewActionTypes.SETCURRENTVIEW,
currentView: currentView,
});
};
+17
View File
@@ -0,0 +1,17 @@
import { currentViewActionTypes } from "./action";
const currentViewInitialState = {
currentView: {},
};
export default function reducer(state = currentViewInitialState, action) {
switch (action.type) {
case currentViewActionTypes.SETCURRENTVIEW:
return {
...state,
currentView: action.currentView,
};
default:
return state;
}
}
+18
View File
@@ -0,0 +1,18 @@
export const myCasesActionTypes = {
GETMYCASES: "GETMYCASES",
SETMYCASES: "SETMYCASES",
UPDATEMYCASES: "UPDATEMYCASES",
};
export const getMyCasesObj = () => (dispatch) => {
return dispatch({
type: myCasesActionTypes.GETMYCASES,
});
};
export const setMyCases = (myCases) => (dispatch) => {
return dispatch({
type: myCasesActionTypes.SETMYCASES,
myCases: myCases,
});
};
+16
View File
@@ -0,0 +1,16 @@
import { myCasesActionTypes } from "./action";
const myCasesInitialState = {
myCases: {},
};
export default function reducer(state = myCasesInitialState, action) {
switch (action.type) {
case myCasesActionTypes.SETMYCASES:
return {
myCases: action.myCases,
};
default:
return state;
}
}
+18
View File
@@ -0,0 +1,18 @@
export const myRepresentationsActionTypes = {
GETMYREPRESENTATIONS: "GETMYREPRESENTATIONS",
SETMYREPRESENTATIONS: "SETMYREPRESENTATIONS",
UPDATEMYREPRESENTATIONS: "UPDATEMYREPRESENTATIONS",
};
export const getMyRepresentationsObj = () => (dispatch) => {
return dispatch({
type: myRepresentationsActionTypes.GETMYREPRESENTATIONS,
});
};
export const setMyRepresentations = (myRepresentations) => (dispatch) => {
return dispatch({
type: myRepresentationsActionTypes.SETMYREPRESENTATIONS,
myRepresentations: myRepresentations,
});
};
+16
View File
@@ -0,0 +1,16 @@
import { myRepresentationsActionTypes } from "./action";
const myRepresentationsInitialState = {
myRepresentations: {},
};
export default function reducer(state = myRepresentationsInitialState, action) {
switch (action.type) {
case myRepresentationsActionTypes.SETMYREPRESENTATIONS:
return {
myRepresentations: action.myRepresentations,
};
default:
return state;
}
}
+19 -3
View File
@@ -1,24 +1,35 @@
import { createStore, applyMiddleware, combineReducers } from "redux";
import { createWrapper, HYDRATE } from "next-redux-wrapper";
import thunkMiddleware from "redux-thunk";
import { reducer as formReducer } from "redux-form";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
import autoMergeLevel1 from "redux-persist/lib/stateReconciler/autoMergeLevel1";
import storage from "redux-persist/lib/storage";
import currentView from "./currentView/reducer";
import search from "./search/reducer";
import searchResultsObj from "./searchOutput/reducer";
import formData from "./formData/reducer";
import appealType from "./appealType/reducer";
import LPAData from "./lpa/reducer";
import accountDetails from "./accountDetails/reducer";
import { reducer as formReducer } from "redux-form";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
import storage from "redux-persist/lib/storage";
import awaitingSubmission from "./awaitingSubmission/reducer";
import myCases from "./myCases/reducer";
import myRepresentations from "./myRepresentations/reducer";
import watchedCases from "./watchedCases/reducer";
//COMBINING ALL REDUCERS
const appReducer = combineReducers({
currentView,
search,
searchResultsObj,
formData,
appealType,
LPAData,
accountDetails,
awaitingSubmission,
myCases,
myRepresentations,
watchedCases,
form: formReducer,
});
@@ -90,12 +101,17 @@ const makeStore = ({ isServer }) => {
const persistConfig = {
key: "acp",
whitelist: [
"currentView",
"search",
"searchResults",
"formData",
"appealType",
"LPAData",
"accountDetails",
"awaitingSubmission",
"myCases",
"myRepresentations",
"watchedCases",
"form",
],
storage: storage,
+18
View File
@@ -0,0 +1,18 @@
export const watchedCasesActionTypes = {
GETWATCHEDCASES: "GETWATCHEDCASES",
SETWATCHEDCASES: "SETWATCHEDCASES",
UPDATEWATCHEDCASES: "UPDATEWATCHEDCASES",
};
export const getWatchedCasesObj = () => (dispatch) => {
return dispatch({
type: watchedCasesActionTypes.GETWATCHEDCASES,
});
};
export const setWatchedCases = (watchedCases) => (dispatch) => {
return dispatch({
type: watchedCasesActionTypes.SETWATCHEDCASES,
watchedCases: watchedCases,
});
};
+16
View File
@@ -0,0 +1,16 @@
import { watchedCasesActionTypes } from "./action";
const watchedCasesInitialState = {
watchedCases: {},
};
export default function reducer(state = watchedCasesInitialState, action) {
switch (action.type) {
case watchedCasesActionTypes.SETWATCHEDCASES:
return {
watchedCases: action.watchedCases,
};
default:
return state;
}
}