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

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

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

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

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

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

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