|
@@ -10,12 +10,12 @@
|
|
|
|
|
|
import combineReducers from 'redux'
|
|
|
import reduxCrudGen from 'redux-gen/crud'
|
|
|
-import reduxBasicGen from 'redux-gen/basic'
|
|
|
+import reduxGen from 'redux-gen/basic'
|
|
|
import { NAME, DATA } from './constants'
|
|
|
// import { call, put, takeEvery } from 'redux-saga/effects'
|
|
|
|
|
|
-const basic = reduxBasicGen()
|
|
|
-const crud = reduxCrudGen()
|
|
|
+const basic = reduxGen(NAME)
|
|
|
+const crud = reduxCrudGen(NAME)
|
|
|
|
|
|
/** actionTypes define what actions are handeled by the reducer. */
|
|
|
const actions = { ...basic.actions, ...crud.actions }
|
|
@@ -27,7 +27,12 @@ export const state = [ ...basic.state, ...crud.state ]
|
|
|
console.log('State state', state)
|
|
|
|
|
|
/** reducer is called by the redux dispatcher and handles all component actions */
|
|
|
-export const reducer = combineReducers(basic.reducer, crud.reducer)
|
|
|
+export function reducer (state = [], action) {
|
|
|
+ let nextState
|
|
|
+ nextState = basic.reducer(state, action)
|
|
|
+ nextState = crud.reducer(nextState, action)
|
|
|
+ return nextState
|
|
|
+}
|
|
|
|
|
|
/** sagas are asynchronous workers (JS generators) to handle the state. */
|
|
|
export const workers = crud.workers
|