Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

updates custom domains query

Alaister Young4b4a863e5bb7
diff --git a/package-lock.json b/package-lock.json
index acc81561c2e..c9d8e65b8ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -61314,8 +61314,8 @@
"@supabase/shared-types": "^0.1.29",
"@supabase/supabase-js": "^2.0.0",
"@tailwindcss/typography": "^0.5.2",
- "@tanstack/react-query": "*",
- "@tanstack/react-query-devtools": "*",
+ "@tanstack/react-query": "^4.14.1",
+ "@tanstack/react-query-devtools": "^4.14.1",
"@testing-library/dom": "^8.11.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
diff --git a/studio/components/interfaces/Settings/API/CustomDomainConfig.tsx b/studio/components/interfaces/Settings/API/CustomDomainConfig.tsx
index 53f8e60081f..85209c0c90c 100644
--- a/studio/components/interfaces/Settings/API/CustomDomainConfig.tsx
+++ b/studio/components/interfaces/Settings/API/CustomDomainConfig.tsx
@@ -2,16 +2,17 @@ import { IconAlertCircle } from 'ui'
import Panel from 'components/ui/Panel'
import { useParams, useStore } from 'hooks'
+import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query'
const CustomDomainConfig = () => {
const { ui } = useStore()
const { ref } = useParams()
- const isError = false
+ const { isError, data } = useCustomDomainsQuery({ projectRef: ref })
return (
<>
- <Panel title={<h5 className="mb-0">Custom Domains</h5>}>
+ <Panel title={<h5 className="mb-0">Custom Domain</h5>}>
<Panel.Content className="space-y-6 border-t border-panel-border-interior-light dark:border-panel-border-interior-dark">
{isError && (
<div className="flex items-center justify-center space-x-2 py-8">
diff --git a/studio/data/custom-domains/custom-domains-query.ts b/studio/data/custom-domains/custom-domains-query.ts
index 19705f783c6..1efa9ff82bb 100644
--- a/studio/data/custom-domains/custom-domains-query.ts
+++ b/studio/data/custom-domains/custom-domains-query.ts
@@ -1,6 +1,5 @@
-import { QueryKey, useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'
-import { post } from 'lib/common/fetch'
-import { API_URL } from 'lib/constants'
+import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'
+import { get } from 'lib/common/fetch'
import { useCallback } from 'react'
import { customDomainKeys } from './keys'
@@ -16,18 +15,17 @@ export async function getCustomDomains(
throw new Error('projectRef is required')
}
- let headers = new Headers()
-
- const response = await post(
- `${API_URL}/pg-meta/${projectRef}/query`,
- { query: '' },
- { headers: Object.fromEntries(headers), signal }
+ const response = await get(
+ `${process.env.NEXT_PUBLIC_API_ADMIN_URL}/projects/${projectRef}/custom-hostname`,
+ {
+ signal,
+ }
)
if (response.error) {
throw response.error
}
- return { result: response }
+ return { customDomains: response }
}
export type CustomDomainsData = Awaited<ReturnType<typeof getCustomDomains>>