(options?: { refreshInterval?: number })
| 90 | * @param options.refreshInterval - If set, refetches at this interval (ms) while the query is active. |
| 91 | */ |
| 92 | export function useTasks(options?: { refreshInterval?: number }) { |
| 93 | return useQuery({ |
| 94 | queryKey: ["tasks"], |
| 95 | queryFn: () => |
| 96 | api.tasks.$get().then((res) => res.json() as Promise<Task[]>), |
| 97 | ...(options?.refreshInterval != null && { |
| 98 | refetchInterval: options.refreshInterval, |
| 99 | }), |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Deletes a task by ID. |