UNPKG

@omegabigdata/honoplay-redux-helper

Version:
40 lines (35 loc) 1.1 kB
import { CREATE_PROFESSION_FAILED, CREATE_PROFESSION_SUCCESS, CREATING_PROFESSION, FETCHING_PROFESSION_LIST, FETCH_PROFESSION_LIST_FAILED, FETCH_PROFESSION_LIST_SUCCESS } from "../helpers/ActionTypes/Profession"; import { Profession } from "@omegabigdata/honoplay-api-helper-node"; const fetchProfessionList = (skip = null, take = null) => dispatch => { dispatch({ type: FETCHING_PROFESSION_LIST }); Profession.getProfessions( skip, take, success => { dispatch({ type: FETCH_PROFESSION_LIST_SUCCESS, data: success.data }); }, error => { dispatch({ type: FETCH_PROFESSION_LIST_FAILED, data: { error } }); } ); }; const createProfession = professionModel => dispatch => { dispatch({ type: CREATING_PROFESSION }); Profession.postProfession( professionModel, success => { dispatch({ type: CREATE_PROFESSION_SUCCESS, data: success.data }); }, error => { dispatch({ type: CREATE_PROFESSION_FAILED, data: { error } }); } ); }; export { fetchProfessionList, createProfession };