tailscale/client/web
Sonia Appasamy 97f8577ad2 client/web: restructure api mutations into hook
This commit makes some restructural changes to how we handle api
posting from the web client frontend.

Now that we're using SWR, we have less of a need for hooks like
useNodeData that return a useSWR response alongside some mutation
callbacks. SWR makes it easy to mutate throughout the UI without
needing access to the original data state in order to reflect
updates. So, we can fetch data without having to tie it to post
callbacks that have to be passed around through components.

In an effort to consolidate our posting endpoints, and make it
easier to add more api handlers cleanly in the future, this change
introduces a new `useAPI` hook that returns a single `api` callback
that can make any changes from any component in the UI. The hook
itself handles using SWR to mutate the relevant data keys, which
get globally reflected throughout the UI.

As a concurrent cleanup, node types are also moved to their own
types.ts file, to consolidate data types across the app.

Updates #10261

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-12-07 18:32:32 -05:00
..
build client/web: clean up assets handling 2023-09-08 16:05:11 -04:00
src client/web: restructure api mutations into hook 2023-12-07 18:32:32 -05:00
assets.go client/web: server /index.html on 404 requests 2023-11-14 15:29:55 -08:00
auth.go client/web: skip check mode for non-tailscale.com control servers (#10413) 2023-11-29 08:44:48 -08:00
index.html client/web: small tweaks for small screens 2023-12-05 08:05:09 -08:00
package.json client/web: start using swr for some fetching 2023-12-06 21:20:13 -05:00
qnap.go client/web: add readonly/manage toggle 2023-11-10 15:01:34 -05:00
styles.json client/web: adjust colors and some UI margins 2023-12-01 15:41:57 -05:00
synology.go client/web: add readonly/manage toggle 2023-11-10 15:01:34 -05:00
tailwind.config.js client/web: adjust colors and some UI margins 2023-12-01 15:41:57 -05:00
tsconfig.json client/web: add debug mode for web client ui updates 2023-09-28 15:45:33 -04:00
vite.config.ts client/web: fix hotreload proxy 2023-11-06 16:31:30 -05:00
web_test.go client/web: skip check mode for non-tailscale.com control servers (#10413) 2023-11-29 08:44:48 -08:00
web.go client/web: restructure api mutations into hook 2023-12-07 18:32:32 -05:00
yarn.lock client/web: start using swr for some fetching 2023-12-06 21:20:13 -05:00