summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/paragraph/paragraph.reducer.js
blob: 3b3312847192db25bb68617ae8c9833db5a61404 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as types from 'app/types'
// import { session, getDefault, getDefaultInt } from 'app/session'

import { crudState, crudReducer } from 'app/api/crud.reducer'

const initialState = crudState('paragraph', {
  paragraphs: [],
  footnotes: [],
  options: {
  }
})

const reducer = crudReducer('paragraph')

export default function paragraphReducer(state = initialState, action) {
  // console.log(action.type, action)
  state = reducer(state, action)
  switch (action.type) {
    case types.paragraph.update_transcript:
      return {
        ...state,
        paragraphs: action.paragraphs,
        footnotes: action.footnotes,
      }
    default:
      return state
  }
}