Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
12345678910111213141516171819202122232425import { queryOptions, useQuery } from "@octanejs/tanstack-query";import type { TaskSummary } from "../../../shared/tasks";import type { CustomerQuerySession } from "../customer-query-session";import { useCustomerQuerySession } from "../customer-query-provider";import { callOwner, type SettingsConnection } from "../owner-rpc";
export function taskOptions( session: CustomerQuerySession, connection: SettingsConnection, id: string,) { return queryOptions({ queryKey: session.key("tasks", "detail", id), enabled: !!session.getSnapshot().scope && !!connection?.isReady() && !!id, staleTime: 0, queryFn: ({ signal }) => callOwner<TaskSummary>(connection, "getTask", [id], signal), });}
export function useTaskQuery(connection: SettingsConnection, id: string) { const session = useCustomerQuerySession(); return useQuery(taskOptions(session, connection, id));}