summaryrefslogtreecommitdiff
path: root/app/client/modules/samplernn/samplernn.reducer.js
blob: e486e3f9c7b19d904f7c132c81e42f377f5768cb (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import types from '../../types'

const samplernnInitialState = {
  loading: false,
  error: null,
  folder: {},
  folders: [],
  files: [],
  results: [],
}

const samplernnReducer = (state = samplernnInitialState, action) => {
  switch(action.type) {
    case types.socket.connect:
      return {
        ...state,
      }
    case types.task.task_begin:
      return {
        ...state,
      }
    case types.task.task_finish:
      return {
        ...state,
      }
    case types.folder.index:
      console.log(action)
      return {
        ...state,
        folders: action.data,
        folder: action.data[0],
      }
    case types.folder.update:
      console.log(action)
      return state
    case types.file.index:
      console.log(action)
      return {
        ...state,
        files: action.data
      }
    case types.file.create:
      console.log(action)
      return {
        ...state,
        files: [action.data].concat(this.files)
      }
      return
    case types.folder.upload_error:
    console.log(action)
      return state
    case types.folder.upload_progress:
    console.log(action)
      return state
    case types.folder.upload_complete:
    console.log(action)
      return state

    default:
      return state
  }
}

export default samplernnReducer