added some mocked data calls
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
export const searchResultsActionTypes = {
|
||||
GETSEARCHRESULTS: "GETSEARCHRESULTS",
|
||||
SETSEARCHRESULTS: "SETSEARCHRESULTS",
|
||||
UPDATESEARCHRESULTS: "UPDATESEARCHRESULTS",
|
||||
};
|
||||
|
||||
export const getSearchResultshObj = () => (dispatch) => {
|
||||
return dispatch({
|
||||
type: searchResultsActionTypes.GETSEARCHRESULTS,
|
||||
});
|
||||
};
|
||||
|
||||
export const setSearchResults = (searchResults) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: searchResultsActionTypes.SETSEARCHRESULTS,
|
||||
searchResultsObj: searchResults,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { searchResultsActionTypes } from "./action";
|
||||
|
||||
const searchResultsInitialState = {
|
||||
searchResultsObj: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = searchResultsInitialState, action) {
|
||||
switch (action.type) {
|
||||
case searchResultsActionTypes.SETSEARCHRESULTS:
|
||||
return {
|
||||
searchResultsObj: action.searchResultsObj,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -3,6 +3,7 @@ import { createWrapper, HYDRATE } from "next-redux-wrapper";
|
||||
import thunkMiddleware from "redux-thunk";
|
||||
import progress from "./progress/reducer";
|
||||
import search from "./search/reducer";
|
||||
import searchResultsObj from "./searchOutput/reducer";
|
||||
import { reducer as formReducer } from "redux-form";
|
||||
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
|
||||
@@ -10,6 +11,7 @@ import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
const combinedReducer = combineReducers({
|
||||
progress,
|
||||
search,
|
||||
searchResultsObj
|
||||
});
|
||||
|
||||
const reducer = (state = { progress: "{}" }, action) => {
|
||||
@@ -70,7 +72,7 @@ const makeStore = ({ isServer }) => {
|
||||
|
||||
const persistConfig = {
|
||||
key: "nextjs",
|
||||
whitelist: ["progress,search"],
|
||||
whitelist: ["progress,search,searchResults"],
|
||||
storage,
|
||||
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user