mirror of
https://github.com/supabase/supabase.git
synced 2026-05-24 20:58:45 +08:00
* Initial work. * Add missing import. * Minor fixes. * Minor fixes. * Add a feature flag for the refresh toast. * Add a commit for testing. Revert before merging. * Remove header caching for testing. * Tiny lint * Fix * One more --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
24 lines
845 B
TypeScript
24 lines
845 B
TypeScript
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
import { fetchHandler } from 'data/fetchers'
|
|
import { BASE_PATH } from 'lib/constants'
|
|
import { ResponseError } from 'types'
|
|
|
|
export async function getDeploymentCommit(signal?: AbortSignal) {
|
|
const response = await fetchHandler(`${BASE_PATH}/api/get-deployment-commit`)
|
|
return (await response.json()) as { commitSha: string; commitTime: string }
|
|
}
|
|
|
|
export type DeploymentCommitData = Awaited<ReturnType<typeof getDeploymentCommit>>
|
|
|
|
export const useDeploymentCommitQuery = <TData = DeploymentCommitData>({
|
|
enabled = true,
|
|
...options
|
|
}: UseQueryOptions<DeploymentCommitData, ResponseError, TData> = {}) =>
|
|
useQuery<DeploymentCommitData, ResponseError, TData>(
|
|
['deployment-commit'],
|
|
({ signal }) => getDeploymentCommit(signal),
|
|
{
|
|
...options,
|
|
}
|
|
)
|