summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/align.reducer.js
blob: e9e98f351caf25518e267d352e8d511e25b2b866 (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
29
30
import * as types from '../../types'
import { session, getDefault, getDefaultInt } from '../../session'

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

const initialState = {
  timeline: {
    start_ts: 0,
    zoom: 0,
    duration: 0,
  },
  options: {
  }
}

export default function alignReducer(state = initialState, action) {
  // console.log(action.type, action)
  switch (action.type) {
    case types.peaks.loaded:
      return {
        ...state,
        timeline: {
          ...state.timeline,
          duration: action.data.length / 2,
        }
      }
    default:
      return state
  }
}