client/web: start using swr for some fetching

Adds swr to the web client, and starts by using it from the
useNodeData hook.

Updates #10261

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy
2023-12-05 18:03:05 -05:00
committed by Sonia Appasamy
parent 014ae98297
commit 95655405b8
9 changed files with 70 additions and 68 deletions

View File

@ -146,8 +146,7 @@ type TailscaleUpOptions = {
}
function tailscaleUp(options: TailscaleUpOptions) {
return apiFetch("/up", "POST", options)
.then((r) => r.json())
return apiFetch<{ url?: string }>("/up", "POST", options)
.then((d) => {
d.url && window.open(d.url, "_blank")
})