enduserLoginAction.js 1004 Bytes
import axios from "axios";
import qs from "qs";

export const finishEndUserOtpLogin = async ({ mobileNumber, emailAddress, oneTimePassword }) => {
  // 1. invoke the api to start the login with otp process.
  const config = {
    headers: {
      "Content-Type": "application/json"
    }
  };

  return await axios.post(
    `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/users-permissions/users/end-user/finish-otp-login`,
    {
      mobileNumber,
      emailAddress,
      oneTimePassword
    },
    config
  );
};

export const startEndUserOtpLogin = async ({ mobileNumber, emailAddress }) => {
  // 1. invoke the api to start the login with otp process.
  const config = {
    headers: {
      "Content-Type": "application/json"
    }
  };

  const startOtpLoginResponse = await axios.post(
    `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/users-permissions/users/end-user/start-otp-login`,
    {
      mobileNumber,
      emailAddress
    },
    config
  );

  return startOtpLoginResponse;
};