File
Blob: src/client/lib/queries/page-ancestors.ts
| 1 | import { queryOptions } from "@tanstack/react-query"; |
| 2 | import { api } from "@/client/lib/api"; |
| 3 | import type { PageAncestor } from "@/shared/types"; |
| 4 | |
| 5 | export const pageAncestorsQueryKey = (workspaceId: string, pageId: string, shareToken?: string | null) => |
| 6 | ["page-ancestors", workspaceId, pageId, shareToken ?? null] as const; |
| 7 | |
| 8 | export 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 | }); |