/* eslint-disable handle-callback-err */
import { PostData, GetURL } from '../helpers'
import url from '../url'

export const getListSupplier = async (body) =>
    PostData(url.urlGetListSupplier, body)
        .then((res) => res)
        .catch((err) => null)

export const createSupplier = async (body) =>
    PostData(url.urlCreateSupplier, body)
        .then((res) => res)
        .catch((err) => null)

export const updateSupplier = async (body) =>
    PostData(url.urlUpdateSupplier, body)
        .then((res) => res)
        .catch((err) => null)

export const detailSupplier = async (id, body) =>
    GetURL(`${url.urlDetailSupplier}/${id}`, body)
        .then((res) => res)
        .catch((err) => null)

export const deleteSupplier = async (body) =>
    PostData(url.urlDeleteSupplier, body)
        .then((res) => res)
        .catch((err) => null)
export const changeStatusSupplier = async (body) =>
    PostData(url.changeStatusSupplier, body)
        .then((res) => res)
        .catch((err) => null)

export const piechartPaymentPartner = async (body) =>
    PostData(url.piechartPaymentPartner, body)
        .then((res) => res)
        .catch((err) => null)

export const linechartPaymentPartner = async (body) =>
    PostData(url.linechartPaymentPartner, body)
        .then((res) => res)
        .catch((err) => null)
