import api from '@/lib/api-client'; import { IMovePage, IPage, IWorkspacePageOrder } from '@/features/page/types/page.types'; export async function createPage(data: Partial): Promise { const req = await api.post('/pages/create', data); return req.data as IPage; } export async function getPageById(id: string): Promise { const req = await api.post('/pages/details', { id }); return req.data as IPage; } export async function getRecentChanges(): Promise { const req = await api.post('/pages/recent'); return req.data as IPage[]; } export async function getPages(): Promise { const req = await api.post('/pages'); return req.data as IPage[]; } export async function getWorkspacePageOrder(): Promise { const req = await api.post('/pages/ordering'); return req.data as IWorkspacePageOrder[]; } export async function updatePage(data: Partial): Promise { const req = await api.post(`/pages/update`, data); return req.data as IPage; } export async function movePage(data: IMovePage): Promise { await api.post('/pages/move', data); } export async function deletePage(id: string): Promise { await api.post('/pages/delete', { id }); }