37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { PaginationRequest } from "@/types/globals";
|
|
import {
|
|
httpDeleteInterceptor,
|
|
httpGetInterceptor,
|
|
httpPostInterceptor,
|
|
httpPutInterceptor,
|
|
} from "./http-config/http-interceptor-services";
|
|
|
|
export async function getProductPagination(props: PaginationRequest) {
|
|
const { page, limit, search } = props;
|
|
return await httpGetInterceptor(`/products`);
|
|
}
|
|
|
|
// export async function createProduct(data: any) {
|
|
// const pathUrl = `/products`;
|
|
// return await httpPostInterceptor(pathUrl, data);
|
|
// }
|
|
|
|
export async function createProduct(data: any) {
|
|
const headers = {
|
|
"content-type": "multipart/form-data",
|
|
};
|
|
return await httpPostInterceptor(`/products`, data, headers);
|
|
}
|
|
|
|
export async function updateProduct(data: any, id: any) {
|
|
const pathUrl = `/products/${id}`;
|
|
return await httpPutInterceptor(pathUrl, data);
|
|
}
|
|
|
|
export async function deleteProduct(id: string) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpDeleteInterceptor(`products/${id}`, headers);
|
|
}
|