mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-14 23:41:34 -05:00
* feat: display notification when new release is available * refactor: standalone re-usable cache util * refactor: clear cache on server startup * refactor: add timeout to gh release fetch * fix: run with app version env variable
19 lines
423 B
TypeScript
19 lines
423 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { getUpdatesOptions } from "../api-client/@tanstack/react-query.gen";
|
|
|
|
export function useUpdates() {
|
|
const { data, isLoading, error } = useQuery({
|
|
...getUpdatesOptions(),
|
|
staleTime: 60 * 60 * 1000,
|
|
gcTime: 24 * 60 * 60 * 1000,
|
|
refetchOnWindowFocus: false,
|
|
});
|
|
|
|
return {
|
|
updates: data,
|
|
hasUpdate: data?.hasUpdate ?? false,
|
|
isLoading,
|
|
error,
|
|
};
|
|
}
|