From f2b4c0a227404c3a796e93257f6b2de3614b5386 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 06:35:04 +0100 Subject: [PATCH] auto-claude: subtask-1-4 - Add JSDoc to api.ts (fetchWithTimeout function) --- src/utils/api.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/api.ts b/src/utils/api.ts index 53326d6..b244e06 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -1,9 +1,25 @@ +/** + * API Utility Functions + * Provides enhanced fetch functionality with timeout support + */ + import { handleError, createAPIError } from './errorHandling'; +/** + * Extended request options with timeout support + */ interface RequestOptions extends RequestInit { + /** Request timeout in milliseconds (default: 8000ms) */ timeout?: number; } +/** + * Fetch with automatic timeout and error handling + * @param resource - URL or resource to fetch + * @param options - Request options including optional timeout + * @returns Promise resolving to the fetch Response + * @throws {Error} On timeout, network error, or HTTP error status + */ export async function fetchWithTimeout( resource: string, options: RequestOptions = {}