mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
06d854a7d2
* ui polishing * frontend and backend fixes
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import api from "@/lib/api-client";
|
|
import {
|
|
IMovePage,
|
|
IPage,
|
|
IPageInput,
|
|
SidebarPagesParams,
|
|
} from "@/features/page/types/page.types";
|
|
import { IPagination } from "@/lib/types.ts";
|
|
|
|
export async function createPage(data: Partial<IPage>): Promise<IPage> {
|
|
const req = await api.post<IPage>("/pages/create", data);
|
|
return req.data;
|
|
}
|
|
|
|
export async function getPageById(
|
|
pageInput: Partial<IPageInput>,
|
|
): Promise<IPage> {
|
|
const req = await api.post<IPage>("/pages/info", pageInput);
|
|
return req.data;
|
|
}
|
|
|
|
export async function updatePage(data: Partial<IPageInput>): Promise<IPage> {
|
|
const req = await api.post<IPage>("/pages/update", data);
|
|
return req.data;
|
|
}
|
|
|
|
export async function deletePage(pageId: string): Promise<void> {
|
|
await api.post("/pages/delete", { pageId });
|
|
}
|
|
|
|
export async function movePage(data: IMovePage): Promise<void> {
|
|
await api.post<void>("/pages/move", data);
|
|
}
|
|
|
|
export async function getSidebarPages(
|
|
params: SidebarPagesParams,
|
|
): Promise<IPagination<IPage>> {
|
|
const req = await api.post("/pages/sidebar-pages", params);
|
|
return req.data;
|
|
}
|
|
|
|
export async function getPageBreadcrumbs(
|
|
pageId: string,
|
|
): Promise<Partial<IPage[]>> {
|
|
const req = await api.post("/pages/breadcrumbs", { pageId });
|
|
return req.data;
|
|
}
|
|
|
|
export async function getRecentChanges(
|
|
spaceId?: string,
|
|
): Promise<IPagination<IPage>> {
|
|
const req = await api.post("/pages/recent", { spaceId });
|
|
return req.data;
|
|
}
|