product.js 1.9 KB
Newer Older
Giang Tran committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
/* eslint-disable handle-callback-err */
import { PostData, GetURL } from '../helpers'
import url from '../url'

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

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

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

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

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

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

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

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

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

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