mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 09:20:21 -04:00
7f5865872a
## Context Enforce `noUnusedLocals` and `noUnusedParameters` in tsconfig.json + fix all related issues
23 lines
840 B
TypeScript
23 lines
840 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { fetchHandler } from '@/data/fetchers'
|
|
import { BASE_PATH } from '@/lib/constants'
|
|
import type { ResponseError, UseCustomQueryOptions } from '@/types'
|
|
|
|
export async function getDeploymentCommit() {
|
|
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
|
|
}: UseCustomQueryOptions<DeploymentCommitData, ResponseError, TData> = {}) =>
|
|
useQuery<DeploymentCommitData, ResponseError, TData>({
|
|
queryKey: ['deployment-commit'],
|
|
queryFn: () => getDeploymentCommit(),
|
|
...options,
|
|
})
|