client/web: only trigger check mode if not authed

After logging in, the `?check=now` query string is still present if it
was passed. Reloading the page causes a new check mode to be triggered,
even though the user has an active session. Only trigger the automatic
check mode if the user is not already able to manage the device.

Updates tailscale/corp#14335

Signed-off-by: Will Norris <will@tailscale.com>
pull/10248/head
Will Norris 7 months ago committed by Will Norris
parent 79719f05a9
commit 74947ce459

@ -41,6 +41,7 @@ export default function useAuth() {
default:
setLoading(false)
}
return d
})
.catch((error) => {
setLoading(false)
@ -64,10 +65,14 @@ export default function useAuth() {
}, [])
useEffect(() => {
loadAuth()
if (new URLSearchParams(window.location.search).get("check") == "now") {
newSession()
}
loadAuth().then((d) => {
if (
!d.canManageNode &&
new URLSearchParams(window.location.search).get("check") == "now"
) {
newSession()
}
})
}, [])
return {

Loading…
Cancel
Save