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
|
import types from '../types'
const datasetInitialState = {
loading: false,
error: null,
status: '',
}
const datasetReducer = (state = datasetInitialState, action) => {
switch(action.type) {
case types.folder.upload_loading:
return {
error: null,
loading: true,
status: 'Loading...',
}
case types.folder.upload_error:
return {
error: null,
loading: false,
status: 'Error uploading :(',
}
case types.folder.upload_progress:
return {
error: null,
loading: true,
status: 'Upload progress ' + action.percent + '%',
}
case types.folder.upload_waiting:
return {
error: null,
loading: true,
status: 'Waiting for server to finish processing...',
}
case types.folder.upload_complete:
return {
error: null,
loading: false,
status: 'Upload complete',
}
case types.file.create_loading:
return {
error: null,
loading: true,
status: 'Creating file...'
}
case types.socket.status:
return datasetSocket(state, action.data)
default:
return state
}
}
const datasetSocket = (state, action) => {
console.log(action)
switch (action.key) {
default:
return state
}
}
export default datasetReducer
|