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

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

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

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

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

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