UNPKG

@omegabigdata/honoplay-redux-helper

Version:
49 lines (44 loc) 1.32 kB
import { FETCHING_TRAINING_CATEGORY_LIST, FETCH_TRAINING_CATEGORY_LIST_SUCCESS, FETCH_TRAINING_CATEGORY_LIST_FAILED, FETCHING_TRAINING_CATEGORY, FETCH_TRAINING_CATEGORY_SUCCESS, FETCH_TRAINING_CATEGORY_FAILED } from '../helpers/ActionTypes/TrainingCategory'; import { TrainingCategory } from '@omegabigdata/honoplay-api-helper-node'; const fetchTrainingCategoryList = (skip = null, take = null) => dispatch => { dispatch({ type: FETCHING_TRAINING_CATEGORY_LIST }); TrainingCategory.getTrainingCategories( skip, take, success => { dispatch({ type: FETCH_TRAINING_CATEGORY_LIST_SUCCESS, data: success.data }); }, error => { dispatch({ type: FETCH_TRAINING_CATEGORY_LIST_FAILED, data: { error } }); } ); }; const fetchTrainingCategory = trainingCategoryId => dispatch => { dispatch({ type: FETCHING_TRAINING_CATEGORY }); TrainingCategory.getTrainingCategory( trainingCategoryId, success => { dispatch({ type: FETCH_TRAINING_CATEGORY_SUCCESS, data: success.data }); }, error => { dispatch({ type: FETCH_TRAINING_CATEGORY_FAILED, data: { error } }); } ); }; export { fetchTrainingCategoryList, fetchTrainingCategory };