This repository was archived by the owner on Dec 9, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11import { combineReducers } from 'redux' ;
22import { connectRouter } from 'connected-react-router' ;
3- import ShowsReducer from './shows/ShowsReducer' ;
43import RequestingReducer from './requesting/RequestingReducer' ;
54import ErrorReducer from './error/ErrorReducer' ;
5+ import ShowsReducer from './shows/ShowsReducer' ;
66
77export default ( history ) => {
88 const reducerMap = {
Original file line number Diff line number Diff line change @@ -2,12 +2,18 @@ export default class BaseReducer {
22 initialState = { } ;
33
44 reducer = ( state = this . initialState , action ) => {
5- const handler = this [ action . type ] ;
5+ // if the action type is used for a method name then this be a reference to
6+ // that class method.
7+ // if the action type is not found then the "method" const will be undefined.
8+ const method = this [ action . type ] ;
69
7- if ( ! handler || action . error ) {
10+ // if the action type "method" const is undefined or the action is an error
11+ // return the state.
12+ if ( ! method || action . error ) {
813 return state ;
914 }
1015
11- return handler ( state , action ) ;
16+ // Return the modified state from the method.
17+ return method ( state , action ) ;
1218 } ;
1319}
You can’t perform that action at this time.
0 commit comments