refoundStatisticsActions.js
956 Bytes
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
'use strict'
import HomeService from '../../services/HomeService';
const {
REFOUND_STATS_REQUEST,
REFOUND_STATS_SUCCESS,
REFOUND_STATS_FAILURE,
} = require('../../constants/actionTypes').default;
export function refoundStatsRequest(params) {
return {
type: REFOUND_STATS_REQUEST,
payload: params
};
}
export function refoundStatsSuccess(json) {
return {
type: REFOUND_STATS_SUCCESS,
payload: json
};
}
export function refoundStatsFailure(error) {
return {
type: REFOUND_STATS_FAILURE,
payload: error
};
}
export function refoundStats(params) {
return dispatch => {
dispatch(refoundStatsRequest(params));
return new HomeService().refoundStats(params)
.then(json => {
dispatch(refoundStatsSuccess(json));
})
.catch(error => {
dispatch(refoundStatsFailure(error));
});
};
}