/* eslint-disable @typescript-eslint/no-explicit-any */ import { useQuery } from "@tanstack/react-query"; import { getAllConversationData } from "../../service/sidebarApi"; // import { fetchMessages } from "../../service/messageService"; export const useGetConversations = (id: any) => { return useQuery({ queryKey: ['GET_ALL_CONVERSATION', id], queryFn: () => id ? getAllConversationData(id) : Promise.reject("No ID provided"), staleTime: 1 * 60 * 1000, enabled: !!id, refetchOnWindowFocus: false, }); }; // export const useMessages = (chatId: string| undefined, userid: string) => { // return useQuery({ // queryKey: ['messages', chatId, userid], // queryFn: () => { // console.log('Fetching messages for:', chatId, userid); // return fetchMessages(chatId, userid); // }, // }); // };