joyce/src/reducers/index.js

27 lines
534 B
JavaScript

import { combineReducers } from 'redux'
import objectAssign from 'object-assign' // Object.assign() polyfill for older browsers
const chapters = (state=[], action) => {
switch(action.type) {
case 'GET_CHAPTER_DATA_RECEIVED':
return action.data
default:
return state
}
}
const currentChapter = (state={}, action) => {
switch(action.type) {
case 'GET_TEXT_DATA_RECEIVED':
return action.data
default:
return state
}
}
const readerApp = combineReducers({
chapters,
currentChapter
})
export default readerApp