blob: f10f3faabdf537ba0c9a18fe36deb8086fa344db (
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
|
import types from '../types'
import moment from 'moment/min/moment.min'
let FileSaver = require('file-saver')
const dashboardInitialState = {
loading: false,
progress: null,
error: null,
data: {},
images: [
],
files: [
]
}
const dashboardReducer = (state = dashboardInitialState, action) => {
switch(action.type) {
case types.app.load_progress:
if (!action.data || action.data.module !== 'dashboard') {
return state
}
return {
...state,
loading: true,
progress: action.progress,
}
case types.dashboard.load:
return {
...state,
loading: false,
error: null,
data: action.data,
}
default:
return state
}
}
export default dashboardReducer
|