Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

799 B
Raw Blame
/* Scheduled chats */
import { useQuery } from '@tanstack/react-query';
import { QueryKeys, dataService } from 'librechat-data-provider';
import type { UseQueryOptions, QueryObserverResult } from '@tanstack/react-query';
import type { TSchedulesResponse } from 'librechat-data-provider';

export const useSchedulesQuery = (
  config?: UseQueryOptions<TSchedulesResponse>,
): QueryObserverResult<TSchedulesResponse> => {
  return useQuery<TSchedulesResponse>([QueryKeys.schedules], () => dataService.getSchedules(), {
    // Automatic runs mutate nextRunAt/lastRun/auto-disable server-side while the
    // panel is open; refresh on focus and on a modest interval so it stays current.
    refetchOnWindowFocus: true,
    refetchOnReconnect: true,
    refetchInterval: 60_000,
    ...config,
  });
};