fix: prevent infinite loading screen by adding sweep timeouts (#32)

fix: prevent infinite loading screen by adding sweep timeouts
This commit is contained in:
Calesthio
2026-03-19 08:00:32 -07:00
committed by GitHub
4 changed files with 51 additions and 18 deletions

View File

@@ -37,11 +37,15 @@ export async function getSeries(seriesIds, opts = {}) {
if (apiKey) payload.registrationkey = apiKey;
try {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 15000);
const res = await fetch(base, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
signal: controller.signal,
});
clearTimeout(timer);
return await res.json();
} catch (e) {
return { error: e.message };