mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
fix: use backend api for all integration URLs (#46290)
Replaces the in-dashboard logic to manually construct the redirect URL with a backend API call, as these are now routed through server-side processing to do Posthog events and status tracking in the marketplace DB. Fixes INT-109
This commit is contained in:
1 parent
908f92d885
commit
90653b2948
1 file changed
+2
-17
+2
-17
@@ -7,7 +7,6 @@ import type { IntegrationDefinition } from '@/components/interfaces/Integrations
|
||||
import { useAPIKeysQuery } from '@/data/api-keys/api-keys-query'
|
||||
import { useInstallOAuthIntegrationMutation } from '@/data/marketplace/install-oauth-integration-mutation'
|
||||
import { useSecretsQuery } from '@/data/secrets/secrets-query'
|
||||
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
||||
|
||||
interface InstallOAuthIntegrationButtonProps {
|
||||
integration: IntegrationDefinition
|
||||
@@ -15,7 +14,6 @@ interface InstallOAuthIntegrationButtonProps {
|
||||
|
||||
export function InstallOAuthIntegrationButton({ integration }: InstallOAuthIntegrationButtonProps) {
|
||||
const { ref: projectRef } = useParams()
|
||||
const { data: selectedOrg } = useSelectedOrganizationQuery()
|
||||
|
||||
const requiresApiKeysCheck =
|
||||
integration.installIdentificationMethod === 'secret_key_prefix' && !!integration.secretKeyPrefix
|
||||
@@ -73,22 +71,9 @@ export function InstallOAuthIntegrationButton({ integration }: InstallOAuthInteg
|
||||
|
||||
const handleInstallClick = async () => {
|
||||
if (!integration || !projectRef) return
|
||||
if (!integration.id) return toast.error('Listing ID is required')
|
||||
|
||||
if (integration.installUrlType === 'post') {
|
||||
if (!integration.id) return toast.error('Listing ID is required')
|
||||
installOAuthIntegration({ projectRef, listingSlug: integration.id })
|
||||
} else {
|
||||
let redirectUrl = '/'
|
||||
|
||||
if (integration.installUrl) {
|
||||
const url = new URL(integration.installUrl)
|
||||
url.searchParams.append('organization_slug', selectedOrg?.slug ?? '')
|
||||
url.searchParams.append('project_id', projectRef)
|
||||
redirectUrl = url.href
|
||||
}
|
||||
|
||||
window.open(redirectUrl, '_blank', 'noreferrer')
|
||||
}
|
||||
installOAuthIntegration({ projectRef, listingSlug: integration.id })
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user