Spaces:
Configuration error
Configuration error
File size: 591 Bytes
2d63f96 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { useQuery } from "@tanstack/react-query";
import OpenHands from "#/api/open-hands";
import { useConversation } from "#/context/conversation-context";
export const useVSCodeUrl = (config: { enabled: boolean }) => {
const { conversationId } = useConversation();
const data = useQuery({
queryKey: ["vscode_url", conversationId],
queryFn: () => {
if (!conversationId) throw new Error("No conversation ID");
return OpenHands.getVSCodeUrl(conversationId);
},
enabled: !!conversationId && config.enabled,
refetchOnMount: true,
});
return data;
};
|