The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
import { useQuery } from '@tanstack/react-query'
import { integrationKeys } from './keys'
import { get, handleError } from '@/data/fetchers'
import type { ResponseError, UseCustomQueryOptions } from '@/types'
export type VercelRedirectVariables = {
installationId?: string
}
export async function getVercelRedirect(
{ installationId }: VercelRedirectVariables,
signal?: AbortSignal
) {
if (!installationId) throw new Error('installationId is required')
const { data, error } = await get(`/platform/vercel/redirect/{installation_id}`, {
params: { path: { installation_id: installationId } },
signal,
})
if (error) handleError(error)
return data
}
export type VercelRedirectData = Awaited<ReturnType<typeof getVercelRedirect>>
export type VercelRedirectError = ResponseError
export const useVercelRedirectQuery = <TData = VercelRedirectData>(
{ installationId }: VercelRedirectVariables,
{
enabled = true,
...options
}: UseCustomQueryOptions<VercelRedirectData, VercelRedirectError, TData> = {}
) =>
useQuery<VercelRedirectData, VercelRedirectError, TData>({
queryKey: integrationKeys.vercelRedirect(installationId),
queryFn: ({ signal }) => getVercelRedirect({ installationId }, signal),
enabled: enabled && typeof installationId !== 'undefined',
...options,
})