First commit
This commit is contained in:
25
src/client/reducers/comicinfo.reducer.js
Normal file
25
src/client/reducers/comicinfo.reducer.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { CV_API_CALL_IN_PROGRESS, CV_SEARCH_SUCCESS } from "../constants/action-types";
|
||||
const initialState = {
|
||||
showResultsPane: false,
|
||||
};
|
||||
|
||||
function comicinfoReducer(state = initialState, action){
|
||||
switch (action.type) {
|
||||
case CV_API_CALL_IN_PROGRESS:
|
||||
return {
|
||||
...state,
|
||||
result: {},
|
||||
showResultsPane: false,
|
||||
};
|
||||
case CV_SEARCH_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
searchResults: action.result,
|
||||
showResultsPane: true,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export default comicinfoReducer;
|
||||
9
src/client/reducers/index.js
Normal file
9
src/client/reducers/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { combineReducers } from "redux";
|
||||
import { connectRouter } from "connected-react-router";
|
||||
import comicinfoReducer from "../reducers/comicinfo.reducer";
|
||||
|
||||
export default (history) =>
|
||||
combineReducers({
|
||||
comicInfo: comicinfoReducer,
|
||||
router: connectRouter(history),
|
||||
});
|
||||
Reference in New Issue
Block a user