import { PaginationRequest } from "@/types/globals"; import { httpDeleteInterceptor, httpGet, httpPost, httpPut, } from "./http-config/axios-base-service"; import Cookies from "js-cookie"; import { httpGetInterceptor } from "./http-config/http-interceptor-services"; const token = Cookies.get("access_token"); export async function createCustomStaticPage(data: any) { const headers = { "content-type": "application/json", Authorization: `Bearer ${token}`, }; const pathUrl = `/custom-static-pages`; return await httpPost(pathUrl, headers, data); } export async function editCustomStaticPage(data: any) { const headers = { "content-type": "application/json", Authorization: `Bearer ${token}`, }; const pathUrl = `/custom-static-pages/${data.id}`; return await httpPut(pathUrl, headers, data); } export async function getCustomStaticPage(props: PaginationRequest) { const { page, limit, search, timeStamp } = props; const headers = { "content-type": "application/json", }; return await httpGetInterceptor( `/custom-static-pages?limit=${limit}&page=${page}&title=${search}`, ); } 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); }