const URL = "/one-api/mockup/nonpersediaanapproved/nonpersediaanapproved/";
// https://accone.aplikasi.web.id/one-api/mockup/purchaserequestkacab/purchaserequestkacab/search

export async function search(payload) {
    try {
        var response = await axios.post(URL + "search", payload);
        if (response.status !== 200) {
            return {
                status: "ERR",
                message: response.statusText,
            };
        }

        let data = response.data;
        return data;
    } catch (e) {
        return {
            status: "ERR",
            message: e.message,
        };
    }
}
export async function getlevel(payload) {
  try {
    var response = await axios.post(URL + "getlevel", payload);
    if (response.status !== 200) {
      return {
        status: "ERR",
        message: response.statusText,
      };
    }

    let data = response.data;
    return data;
  } catch (e) {
    return {
      status: "ERR",
      message: e.message,
    };
  }
}
export async function getDetail(payload) {
    try {
        var response = await axios.post(URL + "getDetail", payload);
        if (response.status !== 200) {
            return {
                status: "ERR",
                message: response.statusText,
            };
        }

        let data = response.data;
        return data;
    } catch (e) {
        return {
            status: "ERR",
            message: e.message,
        };
    }
}
export async function approve(payload) {
    try {
        var response = await axios.post(URL + "approve", payload);
        if (response.status !== 200) {
            return {
                status: "ERR",
                message: response.statusText,
            };
        }

        let data = response.data;
        return data;
    } catch (e) {
        return {
            status: "ERR",
            message: e.message,
        };
    }
}
export async function updateqty(payload) {
    try {
        var response = await axios.post(URL + "updateqty", payload);
        if (response.status !== 200) {
            return {
                status: "ERR",
                message: response.statusText,
            };
        }

        let data = response.data;
        return data;
    } catch (e) {
        return {
            status: "ERR",
            message: e.message,
        };
    }
}