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

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

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

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

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

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

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

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

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

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

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