%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/sagas/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/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,
  );
}

Zerion Mini Shell 1.0