tabby/clients/tabby-ui/lib/hooks/use-latest-release.tsx

15 lines
379 B
TypeScript
Raw Normal View History

"use client"
import useSWRImmutable from 'swr/immutable';
import { SWRResponse } from 'swr'
2023-10-29 06:30:35 +00:00
export interface ReleaseInfo {
name: string
}
export function useLatestRelease(): SWRResponse<ReleaseInfo> {
const fetcher = (url: string) => fetch(url).then(x => x.json());
return useSWRImmutable('https://api.github.com/repos/TabbyML/tabby/releases/latest', fetcher)
}