From 404e5493e9ed387bbccf0c813a4ce206a1081777 Mon Sep 17 00:00:00 2001 From: Saumya Date: Fri, 11 Jul 2025 14:23:44 +0530 Subject: [PATCH] oauth fetch bug fix --- .../agents/pipedream/pipedream-connector.tsx | 5 ---- .../triggers/one-click-integrations.tsx | 23 ------------------ .../triggers/use-oauth-integrations.ts | 24 ------------------- 3 files changed, 52 deletions(-) diff --git a/frontend/src/components/agents/pipedream/pipedream-connector.tsx b/frontend/src/components/agents/pipedream/pipedream-connector.tsx index 6b3bfbd4..041111fb 100644 --- a/frontend/src/components/agents/pipedream/pipedream-connector.tsx +++ b/frontend/src/components/agents/pipedream/pipedream-connector.tsx @@ -122,13 +122,10 @@ export const PipedreamConnector: React.FC = ({ setNewProfileName(''); toast.success('Profile created and connected successfully!'); - // Auto-proceed based on mode if (mode === 'profile-only') { - // Complete immediately with empty tools array onComplete(newProfile.profile_id, [], app.name, app.name_slug); onOpenChange(false); } else { - // Proceed to tools step proceedToTools(); } } catch (error) { @@ -150,7 +147,6 @@ export const PipedreamConnector: React.FC = ({ if (server?.available_tools) { setTools(server.available_tools); - // Auto-select all tools by default setSelectedTools(new Set(server.available_tools.map(tool => tool.name))); } } catch (error) { @@ -166,7 +162,6 @@ export const PipedreamConnector: React.FC = ({ toast.error('Please select at least one tool'); return; } - setIsCompletingConnection(true); try { onComplete(selectedProfileId, Array.from(selectedTools), app.name, app.name_slug); diff --git a/frontend/src/components/agents/triggers/one-click-integrations.tsx b/frontend/src/components/agents/triggers/one-click-integrations.tsx index d1082c42..7fa39d39 100644 --- a/frontend/src/components/agents/triggers/one-click-integrations.tsx +++ b/frontend/src/components/agents/triggers/one-click-integrations.tsx @@ -7,7 +7,6 @@ import { TriggerConfigDialog } from './trigger-config-dialog'; import { TriggerProvider } from './types'; import { Dialog } from '@/components/ui/dialog'; import { - useOAuthIntegrations, useInstallOAuthIntegration, useUninstallOAuthIntegration, useOAuthCallbackHandler @@ -37,8 +36,6 @@ export const OneClickIntegrations: React.FC = ({ agentId }) => { const [configuringSchedule, setConfiguringSchedule] = useState(false); - - const { data: integrationStatus, isLoading, error } = useOAuthIntegrations(agentId); const { data: triggers = [] } = useAgentTriggers(agentId); const installMutation = useInstallOAuthIntegration(); const uninstallMutation = useUninstallOAuthIntegration(); @@ -106,9 +103,6 @@ export const OneClickIntegrations: React.FC = ({ if (provider === 'schedule') { return triggers.find(trigger => trigger.trigger_type === 'schedule'); } - return integrationStatus?.integrations.find(integration => - integration.provider === provider - ); }; const isProviderInstalled = (provider: ProviderKey) => { @@ -123,22 +117,6 @@ export const OneClickIntegrations: React.FC = ({ return integration?.trigger_id; }; - if (error) { - return ( -
-
- -
-

Error Loading Integrations

-

- {error instanceof Error ? error.message : 'Failed to load integrations'} -

-
-
-
- ); - } - const scheduleProvider: TriggerProvider = { provider_id: 'schedule', name: 'Schedule', @@ -153,7 +131,6 @@ export const OneClickIntegrations: React.FC = ({
{Object.entries(OAUTH_PROVIDERS).map(([providerId, config]) => { const provider = providerId as ProviderKey; - const integration = getIntegrationForProvider(provider); const isInstalled = isProviderInstalled(provider); const isLoading = installMutation.isPending || uninstallMutation.isPending || (provider === 'schedule' && (createTriggerMutation.isPending || deleteTriggerMutation.isPending)); diff --git a/frontend/src/hooks/react-query/triggers/use-oauth-integrations.ts b/frontend/src/hooks/react-query/triggers/use-oauth-integrations.ts index 0ac1a4e1..84a875df 100644 --- a/frontend/src/hooks/react-query/triggers/use-oauth-integrations.ts +++ b/frontend/src/hooks/react-query/triggers/use-oauth-integrations.ts @@ -39,22 +39,6 @@ const getAccessToken = async () => { return session.access_token; }; -const fetchOAuthIntegrations = async (agentId: string): Promise => { - const accessToken = await getAccessToken(); - const response = await fetch(`${API_URL}/integrations/status/${agentId}`, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${accessToken}` - }, - }); - - if (!response.ok) { - throw new Error('Failed to fetch OAuth integrations'); - } - - return response.json(); -}; - const initiateOAuthInstall = async (request: OAuthInstallRequest): Promise => { const accessToken = await getAccessToken(); const response = await fetch(`${API_URL}/integrations/install`, { @@ -90,14 +74,6 @@ const uninstallOAuthIntegration = async (triggerId: string): Promise => { } }; -export const useOAuthIntegrations = (agentId: string) => { - return useQuery({ - queryKey: ['oauth-integrations', agentId], - queryFn: () => fetchOAuthIntegrations(agentId), - enabled: !!agentId, - }); -}; - export const useInstallOAuthIntegration = () => { const queryClient = useQueryClient();