MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / bind

Function bind

apps/host-selfhost/web/chromeless/device-page.tsx:37–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 // Claim the pending code for this session; only the same session can then
36 // approve or deny it.
37 const bind = async () => {
38 const res = await fetch(
39 `${globalThis.location.origin}/api/auth/device?user_code=${encodeURIComponent(userCode)}`,
40 { credentials: "include", headers: { accept: "application/json" } },
41 );
42 if (!alive) return;
43 if (res.ok) {
44 setPhase("ready");
45 } else {
46 setPhase("error");
47 setError("This device code is unknown, already used, or expired.");
48 }
49 };
50 void bind();
51 return () => {
52 alive = false;

Callers 1

DevicePageFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected