You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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>
7 months ago
..
build client/web: clean up assets handling 10 months ago
src client/web: restructure api mutations into hook 7 months ago
assets.go client/web: server /index.html on 404 requests 8 months ago
auth.go client/web: skip check mode for non-tailscale.com control servers (#10413) 7 months ago
index.html client/web: small tweaks for small screens 7 months ago
package.json client/web: start using swr for some fetching 7 months ago
qnap.go client/web: add readonly/manage toggle 8 months ago
styles.json client/web: adjust colors and some UI margins 7 months ago
synology.go client/web: add readonly/manage toggle 8 months ago
tailwind.config.js client/web: adjust colors and some UI margins 7 months ago
tsconfig.json client/web: add debug mode for web client ui updates 9 months ago
vite.config.ts client/web: fix hotreload proxy 8 months ago
web.go client/web: restructure api mutations into hook 7 months ago
web_test.go client/web: skip check mode for non-tailscale.com control servers (#10413) 7 months ago
yarn.lock client/web: start using swr for some fetching 7 months ago