Files
supabase/apps/studio/lib/self-hosted.ts
T
Joshen LimandAlaister Young b9a0908331 Refactor post calls from lib/common/fetch in auth pages to data/fetchers (#36506)
* Deprecate use of getWithTimeout, refactor BuildingState and RestoringState to use RQ

* Refactor profile-create-mutation to use data/fetchers, and edge-function-status-query to use fetch

* Shift post from lib/common/fetch, refactor bucket-object-download-mutation

* Address feedback

* Minor fix

* Refactor post calls from lib/common/fetch in auth pages to data/fetchers

* Add missing POST users endpoint + small fix when deleting user via context menu

* simplify handleFetchError

* allow handleFetchError to accept unknown

* non-breaking change

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-07-21 12:45:53 +08:00

16 lines
550 B
TypeScript

import { fetchPost } from 'data/fetchers'
import { constructHeaders } from 'lib/api/apiHelpers'
import { PG_META_URL } from 'lib/constants'
import type { ResponseError } from 'types'
export async function queryPgMetaSelfHosted(sql: string, headersInit?: { [prop: string]: any }) {
const headers = constructHeaders(headersInit ?? {})
const response = await fetchPost(`${PG_META_URL}/query`, { query: sql }, { headers })
if (response.error) {
return { error: response.error as ResponseError }
} else {
return { data: response }
}
}