2024-11-22 10:59:58 +00:00
|
|
|
import { PaginationRequest } from "@/types/globals";
|
|
|
|
|
import {
|
|
|
|
|
httpDeleteInterceptor,
|
|
|
|
|
httpGet,
|
|
|
|
|
httpPost,
|
|
|
|
|
httpPut,
|
|
|
|
|
} from "./http-config/axios-base-service";
|
2025-08-29 06:43:53 +00:00
|
|
|
import Cookies from "js-cookie";
|
|
|
|
|
const token = Cookies.get("access_token");
|
2024-11-22 10:59:58 +00:00
|
|
|
|
|
|
|
|
export async function createCustomStaticPage(data: any) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
2025-08-29 06:43:53 +00:00
|
|
|
Authorization: `Bearer ${token}`,
|
2024-11-22 10:59:58 +00:00
|
|
|
};
|
|
|
|
|
const pathUrl = `/custom-static-pages`;
|
|
|
|
|
return await httpPost(pathUrl, headers, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function editCustomStaticPage(data: any) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
2025-08-29 06:43:53 +00:00
|
|
|
Authorization: `Bearer ${token}`,
|
2024-11-22 10:59:58 +00:00
|
|
|
};
|
|
|
|
|
const pathUrl = `/custom-static-pages/${data.id}`;
|
|
|
|
|
return await httpPut(pathUrl, headers, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getCustomStaticPage(props: PaginationRequest) {
|
|
|
|
|
const { page, limit, search } = props;
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpGet(
|
|
|
|
|
`/custom-static-pages?limit=${limit}&page=${page}&title=${search}`,
|
|
|
|
|
headers
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
export async function getCustomStaticDetail(id: string) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpGet(`/custom-static-pages/${id}`, headers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getCustomStaticDetailBySlug(slug: string) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpGet(`/custom-static-pages/slug/${slug}`, headers);
|
|
|
|
|
}
|