mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-05-19 14:08:24 -04:00
20 lines
454 B
TypeScript
20 lines
454 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,
|
|
refetchOnMount: "always",
|
|
refetchOnWindowFocus: "always",
|
|
});
|
|
|
|
return {
|
|
updates: data,
|
|
hasUpdate: data?.hasUpdate ?? false,
|
|
isLoading,
|
|
error,
|
|
};
|
|
}
|