Skip to content

Function: fetchJson()

fetchJson\<T>(endpoint, options?): Promise\<T>

Defined in: lib/api.ts:171

Generic JSON API fetch with automatic authentication.

Typed wrapper around fetchWithAuth that parses response as JSON. Handles 204 No Content responses by returning undefined.

Type Parameters

Type Parameter Description
T Expected JSON response type

Parameters

Parameter Type Description
endpoint string API endpoint path
options? RequestInit Fetch options

Returns

Promise\<T>

Parsed JSON response

Throws

If fetch or JSON parsing fails