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

Function fetchNeedsSetup

apps/host-selfhost/web/setup-status.ts:17–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15}
16
17export const fetchNeedsSetup = async (): Promise<boolean> => {
18 for (let attempt = 0; attempt < retryDelaysMs.length; attempt += 1) {
19 const response = await fetch("/api/setup-status", { credentials: "same-origin" }).then(
20 (r) => r,
21 () => null,
22 );
23 if (response?.ok) {
24 const data = (await response.json().then(
25 (d) => d,
26 () => ({}),
27 )) as { needsSetup?: boolean };
28 return data.needsSetup === true;
29 }
30 if (attempt < retryDelaysMs.length - 1) await sleep(retryDelaysMs[attempt]);
31 }
32 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: pre-Effect setup-status fetch rejects so the auth gate can surface retry failure
33 throw new SetupStatusError();
34};

Callers 2

AuthGateFunction · 0.90

Calls 3

sleepFunction · 0.70
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected