summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/utils')
-rw-r--r--packages/app/src/utils/server-health.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/app/src/utils/server-health.ts b/packages/app/src/utils/server-health.ts
index db4aa89bd..45a323c7b 100644
--- a/packages/app/src/utils/server-health.ts
+++ b/packages/app/src/utils/server-health.ts
@@ -1,3 +1,4 @@
+import { usePlatform } from "@/context/platform"
import type { ServerConnection } from "@/context/server"
import { createSdkForServer } from "./server"
@@ -81,3 +82,10 @@ export async function checkServerHealth(
.catch((error) => next(count, error))
return attempt(0).finally(() => timeout?.clear?.())
}
+
+export function useCheckServerHealth() {
+ const platform = usePlatform()
+ const fetcher = platform.fetch ?? globalThis.fetch
+
+ return (http: ServerConnection.HttpBase) => checkServerHealth(http, fetcher)
+}