mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-15 01:01:09 +10:00
working page tree
This commit is contained in:
@ -1,28 +1,36 @@
|
||||
import api from '@/lib/api-client';
|
||||
import { IMovePage, IPage, IWorkspacePageOrder } from '@/features/page/types/page.types';
|
||||
import api from "@/lib/api-client";
|
||||
import {
|
||||
IMovePage,
|
||||
IPage,
|
||||
IWorkspacePageOrder,
|
||||
} from "@/features/page/types/page.types";
|
||||
|
||||
export async function createPage(data: Partial<IPage>): Promise<IPage> {
|
||||
const req = await api.post<IPage>('/pages/create', data);
|
||||
const req = await api.post<IPage>("/pages/create", data);
|
||||
return req.data as IPage;
|
||||
}
|
||||
|
||||
export async function getPageById(id: string): Promise<IPage> {
|
||||
const req = await api.post<IPage>('/pages/info', { id });
|
||||
export async function getPageById(pageId: string): Promise<IPage> {
|
||||
const req = await api.post<IPage>("/pages/info", { pageId });
|
||||
return req.data as IPage;
|
||||
}
|
||||
|
||||
export async function getRecentChanges(): Promise<IPage[]> {
|
||||
const req = await api.post<IPage[]>('/pages/recent');
|
||||
const req = await api.post<IPage[]>("/pages/recent");
|
||||
return req.data as IPage[];
|
||||
}
|
||||
|
||||
export async function getPages(): Promise<IPage[]> {
|
||||
const req = await api.post<IPage[]>('/pages');
|
||||
export async function getPages(spaceId: string): Promise<IPage[]> {
|
||||
const req = await api.post<IPage[]>("/pages", { spaceId });
|
||||
return req.data as IPage[];
|
||||
}
|
||||
|
||||
export async function getWorkspacePageOrder(): Promise<IWorkspacePageOrder[]> {
|
||||
const req = await api.post<IWorkspacePageOrder[]>('/pages/ordering');
|
||||
export async function getSpacePageOrder(
|
||||
spaceId: string,
|
||||
): Promise<IWorkspacePageOrder[]> {
|
||||
const req = await api.post<IWorkspacePageOrder[]>("/pages/ordering", {
|
||||
spaceId,
|
||||
});
|
||||
return req.data as IWorkspacePageOrder[];
|
||||
}
|
||||
|
||||
@ -32,9 +40,9 @@ export async function updatePage(data: Partial<IPage>): Promise<IPage> {
|
||||
}
|
||||
|
||||
export async function movePage(data: IMovePage): Promise<void> {
|
||||
await api.post<IMovePage>('/pages/move', data);
|
||||
await api.post<IMovePage>("/pages/move", data);
|
||||
}
|
||||
|
||||
export async function deletePage(id: string): Promise<void> {
|
||||
await api.post('/pages/delete', { id });
|
||||
await api.post("/pages/delete", { id });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user