const URL = "/one-api/mockup/purchase/cashier/PurchaseRequestDirectAdjusment/";

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

        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function searchDetail(params) {
    try {
        var resp = await axios.post(URL + "searchDetail", params)
        if (resp.status !== 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function updateAdjusment(params) {
    try {
        var resp = await axios.post(URL + "updateAdjustment", params)
        if (resp.status !== 200) {
            return {
                status: "ERR",
                message: resp.statusText
            }
        }

        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

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

        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}