mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 11:30:11 +00:00
Tweaks to showing new version available
- 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
This commit is contained in:
@@ -4,6 +4,7 @@ export * from "./useAuditLog";
|
||||
export * from "./useAuditLogs";
|
||||
export * from "./useCertificate";
|
||||
export * from "./useCertificates";
|
||||
export * from "./useCheckVersion";
|
||||
export * from "./useDeadHost";
|
||||
export * from "./useDeadHosts";
|
||||
export * from "./useDnsProviders";
|
||||
|
||||
18
frontend/src/hooks/useCheckVersion.ts
Normal file
18
frontend/src/hooks/useCheckVersion.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user