zzz / frontend /src /hooks /query /use-search-events.ts
ar08's picture
Upload 1040 files
246d201 verified
raw
history blame contribute delete
693 Bytes
import { useQuery } from "@tanstack/react-query";
import { useConversation } from "#/context/conversation-context";
import OpenHands from "#/api/open-hands";
export const useSearchEvents = (params: {
query?: string;
startId?: number;
limit?: number;
eventType?: string;
source?: string;
startDate?: string;
endDate?: string;
}) => {
const { conversationId } = useConversation();
return useQuery({
queryKey: ["search_events", conversationId, params],
queryFn: () => {
if (!conversationId) throw new Error("No conversation ID");
return OpenHands.searchEvents(conversationId, params);
},
enabled: !!conversationId,
});
};