saleStatisticsActions.js
1.12 KB
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
/**
* # guideActions.js
*
* App user guide
*
*/
'use strict';
import {Actions} from 'react-native-router-flux';
import CONFIG from '../../constants/config';
import HomeService from '../../services/HomeService';
const {
SALE_STATS_REQUEST,
SALE_STATS_SUCCESS,
SALE_STATS_FAILURE,
SALE_STATS_CLEAN,
} = require('../../constants/actionTypes').default;
export function saleStatsRequest(params) {
return {
type: SALE_STATS_REQUEST,
payload: params
};
}
export function saleStatsSuccess(json) {
return {
type: SALE_STATS_SUCCESS,
payload: json
};
}
export function saleStatsFailure(error) {
return {
type: SALE_STATS_FAILURE,
payload: error
};
}
export function saleStats(params) {
return dispatch => {
dispatch(saleStatsRequest(params));
return new HomeService().saleStats(params)
.then(json => {
dispatch(saleStatsSuccess(json));
})
.catch(error => {
dispatch(saleStatsFailure(error));
});
};
}
export function saleStatsClean() {
return {
type: SALE_STATS_CLEAN,
}
}