refactor(infra): split provider usage

This commit is contained in:
Peter Steinberger
2026-01-14 05:40:03 +00:00
parent e2f8909982
commit 3e0e608110
21 changed files with 1583 additions and 1484 deletions

View File

@@ -0,0 +1,14 @@
export async function fetchJson(
url: string,
init: RequestInit,
timeoutMs: number,
fetchFn: typeof fetch,
): Promise<Response> {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeoutMs);
try {
return await fetchFn(url, { ...init, signal: controller.signal });
} finally {
clearTimeout(timer);
}
}