client/web: don't show login button if /ok errors

When displaying the login client, we check for connectivity to the
management client by calling it's /ok handler. If that response is
non-200, then there is something wrong with the management client, so
don't render the login button.

Updates #10261

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris 2023-12-11 15:33:55 -08:00 committed by Will Norris
parent 3aa6468c63
commit fc69301fd1
1 changed files with 4 additions and 2 deletions

View File

@ -106,9 +106,11 @@ function LoginPopoverContent({
}
setIsRunningCheck(true)
fetch(`http://${node.IPv4}:5252/ok`, { mode: "no-cors" })
.then(() => {
.then((r) => {
if (r.ok) {
setCanConnectOverTS(true)
}
setIsRunningCheck(false)
setCanConnectOverTS(true)
})
.catch(() => setIsRunningCheck(false))
}, [auth.viewerIdentity, isRunningCheck, node.IPv4])