45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
|
|
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 getBannerData(props: PaginationRequest) {
|
||
|
|
const { page, limit, search } = props;
|
||
|
|
return await httpGetInterceptor(`/banners`);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getBannerById(id: any) {
|
||
|
|
const headers = {
|
||
|
|
"content-type": "application/json",
|
||
|
|
};
|
||
|
|
return await httpGet(`/banners/${id}`, headers);
|
||
|
|
}
|
||
|
|
|
||
|
|
// export async function createBanner(data: any) {
|
||
|
|
// const pathUrl = `/banners`;
|
||
|
|
// return await httpPostInterceptor(pathUrl, data);
|
||
|
|
// }
|
||
|
|
|
||
|
|
export async function createBanner(data: any) {
|
||
|
|
const headers = {
|
||
|
|
"content-type": "multipart/form-data",
|
||
|
|
};
|
||
|
|
return await httpPostInterceptor(`/banners`, data, headers);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function updateBanner(data: any, id: any) {
|
||
|
|
const pathUrl = `/banners/${id}`;
|
||
|
|
return await httpPutInterceptor(pathUrl, data);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function deleteBanner(id: string) {
|
||
|
|
const headers = {
|
||
|
|
"content-type": "application/json",
|
||
|
|
};
|
||
|
|
return await httpDeleteInterceptor(`banners/${id}`, headers);
|
||
|
|
}
|