Skip to content
File

Blob: src/client/lib/queries/page-ancestors.ts

typescript15 lines
1import { queryOptions } from "@tanstack/react-query";
2import { api } from "@/client/lib/api";
3import type { PageAncestor } from "@/shared/types";
4 
5export const pageAncestorsQueryKey = (workspaceId: string, pageId: string, shareToken?: string | null) =>
6 ["page-ancestors", workspaceId, pageId, shareToken ?? null] as const;
7 
8export const pageAncestorsQueryOptions = (workspaceId: string, pageId: string, shareToken?: string | null) =>
9 queryOptions<PageAncestor[]>({
10 queryKey: pageAncestorsQueryKey(workspaceId, pageId, shareToken),
11 queryFn: () => api.pages.ancestors(workspaceId, pageId, shareToken ?? undefined),
12 staleTime: 10_000,
13 retry: false,
14 });