Spaces:
Configuration error

README / frontend /src /hooks /query /use-list-file.ts
gauravanu001's picture
upload
2d63f96 verified
Raw History Blame Contribute Delete
543 Bytes
import { useQuery } from "@tanstack/react-query";
import OpenHands from "#/api/open-hands";
import { useConversation } from "#/context/conversation-context";
interface UseListFileConfig {
path: string;
}
export const useListFile = (config: UseListFileConfig) => {
const { conversationId } = useConversation();
return useQuery({
queryKey: ["file", conversationId, config.path],
queryFn: () => OpenHands.getFile(conversationId, config.path),
enabled: false, // don't fetch by default, trigger manually via `refetch`
});
};