mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
* 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>
16 lines
550 B
TypeScript
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 }
|
|
}
|
|
}
|