const URL = "/one-api/mockup/masterdata/accounting/";

export async function getListing(prm) {
    try {
        var resp = await axios.post(URL + 'mdtype/listtype', prm);
        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 deleteRkType(prm) {
    try {
        var resp = await axios.post(URL + 'mdtype/deleteType', prm);
        if (resp.status != 200) {
            return {
                status: "ERR",
                message: error.message
            };            
        }
        let data = resp.data;
        return data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        };
    }
}

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

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