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

// instructions
export const chassiesPoseDetetction = async ({ body }) => {
  UserExperior.startTimer(CHASSSIS_POSE_DETECTION);
  try {
    const res = await fetch(`${CHASSSIS_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(CHASSSIS_POSE_DETECTION);
    return data;
  } catch (err) {
    errorRecord(err);
    console.log(err);
  }
};
