refactor(desktop): rework default server initialization and connection handling (#16965)
This commit is contained in:
parent
51835ecf90
commit
b76ead3fe8
19 changed files with 400 additions and 584 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue