%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/def/static/js/sagas/ |
Current File : /home/emergentqj/actioncivile/pre-auth/def/static/js/sagas/getProductPackageInfo.js |
import { put, call, takeEvery } from "redux-saga/effects"; import configFunc from "config/config"; import LIST_ACTIONS from "constants/action_types"; import { getDataAction } from "common/actions"; import { getCountryFromCookie } from "utils/countries"; const config = configFunc(); function* runGetProductPackageInfo() { try { const countryCode = getCountryFromCookie(); const getProductPackagesByCountryCode = `${config.apiUrl}signup/packages/${countryCode}`; const { data } = yield call(getDataAction(getProductPackagesByCountryCode, null, true)); yield put({ type: LIST_ACTIONS.GET_PRODUCT_PACKAGE_INFO_SUCCESS, payload: data, }); } catch (e) { yield put({ type: LIST_ACTIONS.GET_PRODUCT_PACKAGE_INFO_ERROR, e, }); } } export default function* getProductPackageInfo(dispatch) { yield takeEvery( LIST_ACTIONS.GET_PRODUCT_PACKAGE_INFO_REQUEST, runGetProductPackageInfo, dispatch, ); }