%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/sagas/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/sagas/getCheckExistingUser.js

// import configFunc from "config/config"
import { put, takeEvery } from "redux-saga/effects";
import LIST_ACTIONS from "../constants/action_types";

// const config = configFunc();

function* runGetCheckExistingUser(_, action) {
  // const isBusinessFlow = action.payload
  //     && action.payload.isBusinessFlow
  //     && action.payload.isBusinessFlow === true
  //   ? "true"
  //   : "false";
  // const url = `${
  //   config.apiUrl
  // }checkexists?isBusinessFlow=${isBusinessFlow}&phonenumber=${encodeURIComponent(
  //   action.payload.phoneNumber,
  // )}`;

  try {
    // const payload = yield call(getDataAction(url, false));

    yield put({
      type: LIST_ACTIONS.GET_CHECK_EXISTING_USER_SUCCESS,
      // TODO: return as if user not found. work later on proper removal (Janno)
      // payload: payload.data,
      payload: {
        isKnownUser: false,
        phoneNumber: action.payload.phoneNumber,
        parkingUser: null,
        parkings: false,
        customerId: null,
        note: "profiles count: 0",
      },
    });
  } catch (error) {
    yield put({
      type: LIST_ACTIONS.GET_CHECK_EXISTING_USER_ERROR,
      error,
    });
  }
}

export default function* getCheckExistingUser(dispatch) {
  yield takeEvery(
    LIST_ACTIONS.GET_CHECK_EXISTING_USER_REQUEST,
    runGetCheckExistingUser,
    dispatch,
  );
}

Zerion Mini Shell 1.0