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

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

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

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

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

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