()
| 15 | } |
| 16 | |
| 17 | export 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 | }; |
no test coverage detected