mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 18:35:07 +03:00
Adds support for the new `integration_status` installation identification method for OAuth marketplace integrations, which will use the new integration state stored in Marketplace DB and updated via partner callbacks. Fixes INT-123
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { queryOptions } from '@tanstack/react-query'
|
|
import type { components } from 'api-types'
|
|
|
|
import { partnersKeys } from './keys'
|
|
import { get, handleError } from '@/data/fetchers'
|
|
|
|
type GetAccountRequestVariables = {
|
|
arId?: string
|
|
}
|
|
|
|
export type AccountRequestDetails = components['schemas']['AccountRequestDetailsDto']
|
|
|
|
async function getAccountRequest({ arId }: GetAccountRequestVariables, signal?: AbortSignal) {
|
|
if (!arId) throw new Error('Account request ID is required')
|
|
|
|
const { data, error } = await get(
|
|
'/platform/stripe/projects/provisioning/account_requests/{id}',
|
|
{
|
|
params: { path: { id: arId } },
|
|
signal,
|
|
}
|
|
)
|
|
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|
|
|
|
export const accountRequestQueryOptions = (
|
|
{ arId }: GetAccountRequestVariables,
|
|
{ enabled = true }: { enabled?: boolean } = { enabled: true }
|
|
) => {
|
|
return queryOptions({
|
|
queryKey: partnersKeys.getStripeProjects(arId),
|
|
queryFn: ({ signal }) => getAccountRequest({ arId }, signal),
|
|
enabled: enabled && typeof arId !== 'undefined',
|
|
})
|
|
}
|