import { apiGet, apiPost } from "@/app/lib/clientApi"; import type { CmsPageListItem, CmsPageView, CmsPageBody, } from "@/app/lib/cmsPages"; // Client calls for the Pages pages (add-cms-pages): only the portal's own // /api/pages/** route handlers, never solvway-mobile-api directly. export function listPages(): Promise { return apiGet("/api/pages"); } export function getPage(id: number | string): Promise { return apiGet(`/api/pages/${encodeURIComponent(id)}`); } export function savePage(body: CmsPageBody): Promise { return apiPost("/api/pages", body); } export function deletePage(id: number | string): Promise { return apiPost(`/api/pages/${encodeURIComponent(id)}/delete`); } /** SAME-REQUEST upload (file_autocommit=Y): call it on save, just before savePage. */ export function uploadPageImage(input: { fileName: string; fileType: string; base: string }): Promise<{ url: string }> { return apiPost<{ url: string }>("/api/pages/image", input); }