From 4482a601f30fdec9e10e5d970124bbd2f4d6c470 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Thu, 4 Dec 2025 01:35:44 +0000 Subject: [PATCH] Fix fetch timeout rolling while in authentication flow. Now each fetch gets a fresh timeout. --- frontend/src/utils/api.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/frontend/src/utils/api.js b/frontend/src/utils/api.js index a29fa80..ed5bfb7 100644 --- a/frontend/src/utils/api.js +++ b/frontend/src/utils/api.js @@ -164,15 +164,10 @@ export async function apiFetch(url, options = {}) { // Ensure credentials are included for cookie-based auth fetchOptions.credentials = fetchOptions.credentials || 'include' - // Add timeout signal if specified and not already present - if (timeout > 0 && !fetchOptions.signal) { - fetchOptions.signal = AbortSignal.timeout(timeout) - } - while (true) { let response try { - response = await fetch(url, fetchOptions) + response = await fetch(url, {...fetchOptions, signal: timeout && AbortSignal.timeout(timeout)}) } catch (error) { // Handle network errors and timeouts if (error.name === 'TimeoutError') {