const URL =  "/one-api/mockup/purchase/listing/PurchaseRequestListing/";

export async function listing_regional(params) {
    try {
        var resp = await axios.post(URL + 'listing_regional', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function listing_branch(params) {
    try {
        var resp = await axios.post(URL + 'listing_branch', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

// export async function listing_purchase_req(params) {
//     try {
//         var resp = await axios.post(URL + 'listing_pr', params)
//         if (resp.status != 200) {
//             return {
//                 status: "ERR",
//                 message: resp.message
//             }
//         }
//         let data = resp.data
//         return data
//     } catch (error) {
//         return {
//             status: "ERR",
//             message: error.message
//         }
//     }
// }

export async function listing_purchase_req(params) {
    try {
        var resp = await axios.post(URL + 'list_purchaserequest', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function add_flag_status(params) {
    try {
        var resp = await axios.post(URL + 'insertstatus', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function edit_flag_status(params) {
    try {
        var resp = await axios.post(URL + 'changestatus', params)
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: resp.message
            }
        }
        let data = resp.data
        return data
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}