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

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

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

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

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

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

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