import { POSE_DETECTION } from "../../Api/ApiUrls";
import { errorRecord } from "../../common/libEventLog/libCrashlytics/libCrashlyticsEvent";
var UserExperior = require("react-native-userexperior");

// instructions
export const poseDetection = async ({ body }) => {
  try {
    console.log("POSE API ->", POSE_DETECTION);
    UserExperior.startTimer(POSE_DETECTION);
    const res = await fetch(`${POSE_DETECTION}`, {
      method: "POST",
      headers: {
        "Content-Type": "multipart/form-data",
      },
      body,
    });
    let data = await res.json();
    if (res.status !== 200) {
      throw new Error(data?.error);
    }
    UserExperior.endTimer(POSE_DETECTION);
    return data;
  } catch (err) {
    errorRecord(err);
    console.log("FROM POSE DETECTION ", err);
  }
};
