mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 08:34:30 +08:00
* Move all studio files from /studio to /apps/studio. * Move studio specific prettier ignores. * Fix the ui references from studio. * Fix the css imports. * Fix all package.json issues. * Fix the prettier setup for the studio app. * Add .turbo folder to prettierignore. * Fix the github workflows.
32 lines
992 B
TypeScript
32 lines
992 B
TypeScript
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
|
|
import { get } from 'data/fetchers'
|
|
import { ResponseError } from 'types'
|
|
import { integrationKeys } from './keys'
|
|
|
|
export async function getIntegrations(signal?: AbortSignal) {
|
|
const { data, error } = await get('/platform/integrations', {
|
|
params: { query: { integration_name: '' } },
|
|
signal,
|
|
})
|
|
if (error) {
|
|
throw error
|
|
}
|
|
|
|
return data
|
|
}
|
|
|
|
export type IntegrationsData = Awaited<ReturnType<typeof getIntegrations>>
|
|
export type ProjectIntegrationConnectionsData = Awaited<ReturnType<typeof getIntegrations>>
|
|
export type IntegrationsError = ResponseError
|
|
|
|
export const useIntegrationsQuery = <TData = IntegrationsData>({
|
|
enabled = true,
|
|
...options
|
|
}: UseQueryOptions<IntegrationsData, IntegrationsError, TData> = {}) =>
|
|
useQuery<IntegrationsData, IntegrationsError, TData>(
|
|
integrationKeys.integrationsList(),
|
|
({ signal }) => getIntegrations(signal),
|
|
{ enabled: enabled, ...options }
|
|
)
|