mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 11:30:11 +00:00
- Added frontend translation for english - Moved frontend api logic to hook and backend api space - Added swagger schema for the new api endpoint - Moved backend logic to its own internal file - Added user agent header to github api check - Added cypress integration test for version check api - Added a memory cache item from github check to avoid hitting it too much
19 lines
508 B
TypeScript
19 lines
508 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { checkVersion, type VersionCheckResponse } from "src/api/backend";
|
|
|
|
const fetchVersion = () => checkVersion();
|
|
|
|
const useCheckVersion = (options = {}) => {
|
|
return useQuery<VersionCheckResponse, Error>({
|
|
queryKey: ["version-check"],
|
|
queryFn: fetchVersion,
|
|
refetchOnWindowFocus: false,
|
|
retry: 5,
|
|
refetchInterval: 30 * 1000, // 30 seconds
|
|
staleTime: 5 * 60 * 1000, // 5 mins
|
|
...options,
|
|
});
|
|
};
|
|
|
|
export { fetchVersion, useCheckVersion };
|