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

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

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

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

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

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