2025-11-18 06:56:39 +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 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) {
|
2025-11-20 06:57:16 +00:00
|
|
|
const headers = {
|
|
|
|
|
"content-type": "multipart/form-data",
|
|
|
|
|
};
|
|
|
|
|
return await httpPutInterceptor(`/banners/${id}`, data, headers);
|
2025-11-18 06:56:39 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-20 06:57:16 +00:00
|
|
|
// export async function updateBanner(data: any, id: any) {
|
|
|
|
|
// const pathUrl = `/banners/${id}`;
|
|
|
|
|
// return await httpPutInterceptor(pathUrl, data);
|
|
|
|
|
// }
|
|
|
|
|
|
2025-11-18 06:56:39 +00:00
|
|
|
export async function deleteBanner(id: string) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpDeleteInterceptor(`banners/${id}`, headers);
|
|
|
|
|
}
|
2026-01-20 01:04:42 +00:00
|
|
|
|
|
|
|
|
export async function approveBanner(id: string | number) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpPutInterceptor(`/banners/${id}/approve`, {}, headers);
|
2026-01-20 03:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function rejectBanner(id: string | number, message?: string) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
2026-01-20 09:22:45 +00:00
|
|
|
return await httpPutInterceptor(
|
|
|
|
|
`/banners/${id}/reject`,
|
|
|
|
|
{ message },
|
|
|
|
|
headers,
|
|
|
|
|
);
|
2026-01-20 03:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-26 03:04:58 +00:00
|
|
|
export async function commentBanner(id: string | number, message?: string) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpPutInterceptor(
|
|
|
|
|
`/banners/${id}/comment`,
|
|
|
|
|
{ message },
|
|
|
|
|
headers,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 09:22:45 +00:00
|
|
|
export async function getApprovalHistory(
|
|
|
|
|
moduleType: string,
|
|
|
|
|
moduleId: string | number,
|
|
|
|
|
) {
|
2026-01-20 03:35:33 +00:00
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
2026-01-20 09:22:45 +00:00
|
|
|
return await httpGet(
|
|
|
|
|
`/approval-histories/${moduleType}/${moduleId}`,
|
|
|
|
|
headers,
|
|
|
|
|
);
|
|
|
|
|
}
|