summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/audio/audio.reducer.js
blob: 6149ca61c49ad6cbd6bb4052deab5bb8683ec1ae (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 'app/types'
import { session, getDefault, getDefaultInt } from 'app/session'

const initialState = {
  playing: false,
  play_ts: 0,
}

export default function alignReducer(state = initialState, action) {
  // console.log(action.type, action)
  switch (action.type) {
    case types.audio.play:
      return {
        ...state,
        playing: true,
      }
    case types.audio.pause:
      return {
        ...state,
        playing: false,
      }
    case types.audio.update_time:
      return {
        ...state,
        play_ts: action.play_ts,
      }
    default:
      return state
  }
}