mirror of
https://github.com/supabase/supabase.git
synced 2026-05-23 10:21:37 +08:00
* start new github integration * query/mutation updates * progress * branch management * update codegen * progress * progress * Refactor GitHub integration URLs * Refactor GitHubIntegrationAuthorize component * Updates * Do not remove GitHub connection when creating new one * Deleting a GH connection when branching is enabled for the project, will also disable branching for that project * Add link to configure connection from org integration settings page * Slight refactor * Support updating CWD path * Change cwd_path to workdir and disallow empty values * Allow for triggering branches on supabase directory changes only * Pass missing supabaseChangesOnly value * Small style fix * Add Authorization GitHub step * Small change * Fix supabase integrations form in project settings * Revert URLa nd client ID * Fix UI issues --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
|
|
import { get } from 'data/fetchers'
|
|
import { ResponseError } from 'types'
|
|
import { integrationKeys } from './keys'
|
|
|
|
// FIXME(kamil): Do not retry, a single check is fine.
|
|
export async function getGitHubAuthorization(signal?: AbortSignal) {
|
|
const { data, error } = await get('/platform/integrations/github/authorization', {
|
|
signal,
|
|
})
|
|
return error ? null : data
|
|
}
|
|
|
|
export type GitHubAuthorizationData = Awaited<ReturnType<typeof getGitHubAuthorization>>
|
|
export type ProjectGitHubRepositoryConnectionsData = Awaited<
|
|
ReturnType<typeof getGitHubAuthorization>
|
|
>
|
|
export type GitHubAuthorizationError = ResponseError
|
|
|
|
export const useGitHubAuthorizationQuery = <TData = GitHubAuthorizationData>({
|
|
enabled = true,
|
|
...options
|
|
}: UseQueryOptions<GitHubAuthorizationData, GitHubAuthorizationError, TData> = {}) => {
|
|
return useQuery<GitHubAuthorizationData, GitHubAuthorizationError, TData>(
|
|
integrationKeys.githubAuthorization(),
|
|
({ signal }) => getGitHubAuthorization(signal),
|
|
{ enabled, staleTime: 0, ...options }
|
|
)
|
|
}
|