refoundStatisticsActions.js 956 Bytes
'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));
            });
	};

}