mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
* Add queries and mutations for third party auth. * Show the ThirdPartyAuth form in the auth settings. * Minor fixes to the mutations. * Add a comment for TODO. * Add all components for third party auth. * Minor fixes. * Update the firebase icons. * Update the api-types. * Fix the barrel file imports. * Make the sheets more intuitive. * Add a dialog for adding RLS policies for the firebase integration. * Hide the 3rd party auth section behind a form. * Fix a type error. * Update the wording on the Add RLS policy dialog. * Replace the sheets with dialogs. * Add fixes for the comments on github. * Minor fixes. * Fix a type error. * Make the delete integration awaitable.
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
import { components } from 'api-types'
|
|
import { get, handleError } from 'data/fetchers'
|
|
import type { ResponseError } from 'types'
|
|
import { keys } from './keys'
|
|
|
|
export type GetThirdPartyAuthIntegrationsVariables = {
|
|
projectRef?: string
|
|
}
|
|
|
|
export type ThirdPartyAuthIntegration = components['schemas']['ThirdPartyAuth']
|
|
|
|
export async function getThirdPartyAuthIntegrations(
|
|
{ projectRef }: GetThirdPartyAuthIntegrationsVariables,
|
|
signal?: AbortSignal
|
|
) {
|
|
if (!projectRef) throw new Error('projectRef is required')
|
|
|
|
const { data, error } = await get('/v1/projects/{ref}/config/auth/third-party-auth', {
|
|
params: { path: { ref: projectRef } },
|
|
signal,
|
|
})
|
|
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|
|
|
|
export type ThirdPartyAuthIntegrationsData = Awaited<
|
|
ReturnType<typeof getThirdPartyAuthIntegrations>
|
|
>
|
|
|
|
export const useThirdPartyAuthIntegrationsQuery = <TData = ThirdPartyAuthIntegrationsData>(
|
|
{ projectRef }: GetThirdPartyAuthIntegrationsVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseQueryOptions<ThirdPartyAuthIntegrationsData, ResponseError, TData> = {}
|
|
) =>
|
|
useQuery<ThirdPartyAuthIntegrationsData, ResponseError, TData>(
|
|
keys.integrations(projectRef),
|
|
({ signal }) => getThirdPartyAuthIntegrations({ projectRef }, signal),
|
|
{
|
|
enabled: enabled && typeof projectRef !== 'undefined',
|
|
...options,
|
|
}
|
|
)
|