jaecoo-cihampelas/service/promotion.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-01-07 08:06:07 +00:00
import { PaginationRequest } from "@/types/globals";
import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
httpPutInterceptor,
} from "./http-config/http-interceptor-services";
import { httpGet } from "./http-config/http-base-services";
export async function getPromotionPagination(props: PaginationRequest) {
const { page, limit, search } = props;
return await httpGetInterceptor(`/promotions`);
}
export async function getPromotionById(id: any) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`/promotions/${id}`, headers);
}
export async function createPromotion(data: any) {
const headers = {
"content-type": "multipart/form-data",
};
return await httpPostInterceptor(`/promotions`, data, headers);
}
export async function updatePromotion(data: any, id: any) {
const pathUrl = `/promotions/${id}`;
return await httpPutInterceptor(pathUrl, data);
}
export async function deletePromotion(id: string) {
const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`promotions/${id}`, headers);
}