mirror of
https://github.com/docmost/docmost.git
synced 2026-06-15 22:48:42 +08:00
59e945562d
* Add page_hierarchy table * feat(ee): page-level permissions * pagination * rename migration fixes * fix * tabs * fix theme * cleanup * sync * page permissions notification * other fixes * sharing disbled * fix column nodes * toggle error handling
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import api from "@/lib/api-client";
|
|
import { IPagination } from "@/lib/types";
|
|
import {
|
|
IAddPagePermission,
|
|
IPagePermissionMember,
|
|
IPageRestrictionInfo,
|
|
IRemovePagePermission,
|
|
IUpdatePagePermissionRole,
|
|
} from "@/ee/page-permission/types/page-permission.types";
|
|
|
|
export async function restrictPage(pageId: string): Promise<void> {
|
|
await api.post("/pages/restrict", { pageId });
|
|
}
|
|
|
|
export async function addPagePermission(
|
|
data: IAddPagePermission,
|
|
): Promise<void> {
|
|
await api.post("/pages/add-permission", data);
|
|
}
|
|
|
|
export async function removePagePermission(
|
|
data: IRemovePagePermission,
|
|
): Promise<void> {
|
|
await api.post("/pages/remove-permission", data);
|
|
}
|
|
|
|
export async function updatePagePermissionRole(
|
|
data: IUpdatePagePermissionRole,
|
|
): Promise<void> {
|
|
await api.post("/pages/update-permission", data);
|
|
}
|
|
|
|
export async function unrestrictPage(pageId: string): Promise<void> {
|
|
await api.post("/pages/remove-restriction", { pageId });
|
|
}
|
|
|
|
export async function getPagePermissions(
|
|
pageId: string,
|
|
cursor?: string,
|
|
): Promise<IPagination<IPagePermissionMember>> {
|
|
const req = await api.post<IPagination<IPagePermissionMember>>(
|
|
"/pages/permissions",
|
|
{ pageId, ...(cursor && { cursor }) },
|
|
);
|
|
return req.data;
|
|
}
|
|
|
|
export async function getPageRestrictionInfo(
|
|
pageId: string,
|
|
): Promise<IPageRestrictionInfo> {
|
|
const req = await api.post<IPageRestrictionInfo>("/pages/permission-info", {
|
|
pageId,
|
|
});
|
|
return req.data;
|
|
}
|