auto-claude: subtask-1-4 - Add JSDoc to api.ts (fetchWithTimeout function)
This commit is contained in:
@@ -1,9 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* API Utility Functions
|
||||||
|
* Provides enhanced fetch functionality with timeout support
|
||||||
|
*/
|
||||||
|
|
||||||
import { handleError, createAPIError } from './errorHandling';
|
import { handleError, createAPIError } from './errorHandling';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extended request options with timeout support
|
||||||
|
*/
|
||||||
interface RequestOptions extends RequestInit {
|
interface RequestOptions extends RequestInit {
|
||||||
|
/** Request timeout in milliseconds (default: 8000ms) */
|
||||||
timeout?: number;
|
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(
|
export async function fetchWithTimeout(
|
||||||
resource: string,
|
resource: string,
|
||||||
options: RequestOptions = {}
|
options: RequestOptions = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user