summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/site/site.actions.js
blob: ee6c523b8b92fc30bc5ae963beeb4300e6643361 (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 { api } from 'app/utils'
import actions from 'app/actions'

export const loadProject = () => dispatch => {
  Promise.all([
    actions.site.loadText(),
    actions.site.loadPeaks(),
    actions.annotation.index(),
    actions.paragraph.index(),
    actions.media.index(),
  ]).then(() => {
    actions.viewer.loadSections()
  }).catch(err => {
    console.error(err)
  })
}

export const loadPeaks = (asdf) => dispatch => (
  api(dispatch, types.peaks, 'peaks', '/static/data_store/peaks/peaks.json')
)

export const loadText = (asdf) => dispatch => (
  api(dispatch, types.text, 'text', '/static/data_store/peaks/text.txt')
)

export const updateText = text => dispatch => (
  dispatch({ type: types.text.loaded, data: text })
)