/** * Custom query hook for platformPagePublished * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useQuery } from '@tanstack/react-query'; import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { customQueryKeys } from '../query-keys'; import type { PlatformPagePublishedVariables } from '../../orm/query'; export type { PlatformPagePublishedVariables } from '../../orm/query'; /** Query key factory - re-exported from query-keys.ts */ export const platformPagePublishedQueryKey = customQueryKeys.platformPagePublished; /** * Query hook for platformPagePublished * * @example * ```tsx * const { data, isLoading } = usePlatformPagePublishedQuery({ variables: { pageSlug, targetSiteId } }); * * if (data?.platformPagePublished) { * console.log(data.platformPagePublished); * } * ``` */ export function usePlatformPagePublishedQuery< TData = { platformPagePublished: unknown | null; }, >( params?: { variables?: PlatformPagePublishedVariables; } & Omit< UseQueryOptions< { platformPagePublished: unknown | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformPagePublishedQuery< TData = { platformPagePublished: unknown | null; }, >( params?: { variables?: PlatformPagePublishedVariables; } & Omit< UseQueryOptions< { platformPagePublished: unknown | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult { const variables = params?.variables ?? {}; const { variables: _variables, ...queryOptions } = params ?? {}; void _variables; return useQuery({ queryKey: platformPagePublishedQueryKey(variables), queryFn: () => getClient().query.platformPagePublished(variables).unwrap(), ...queryOptions, }); } /** * Fetch platformPagePublished without React hooks * * @example * ```ts * const data = await fetchPlatformPagePublishedQuery({ variables: { pageSlug, targetSiteId } }); * ``` */ export async function fetchPlatformPagePublishedQuery(params?: { variables?: PlatformPagePublishedVariables; }) { const variables = params?.variables ?? {}; return getClient().query.platformPagePublished(variables).unwrap(); } /** * Prefetch platformPagePublished for SSR or cache warming * * @example * ```ts * await prefetchPlatformPagePublishedQuery(queryClient, { variables: { pageSlug, targetSiteId } }); * ``` */ export async function prefetchPlatformPagePublishedQuery( queryClient: QueryClient, params?: { variables?: PlatformPagePublishedVariables; } ): Promise { const variables = params?.variables ?? {}; await queryClient.prefetchQuery({ queryKey: platformPagePublishedQueryKey(variables), queryFn: () => getClient().query.platformPagePublished(variables).unwrap(), }); }