OptionaltimeoutRequest timeout in ms. Default: 10_000
OptionalretryMax retry attempts on 5xx/429/408. Default: 0
OptionalsignalExternal abort signal (e.g. from component unmount)
OptionalcsrfRead CSRF token from DOM and attach as header. Default: false
OptionalcsrfURL to fetch when a CSRF-expiry response (HTTP 419) occurs, to obtain a fresh token. The default targets the Laravel Sanctum SPA convention because it's the most common backend issuing 419 — override for other frameworks, or set to '' to disable the auto-refresh entirely (the lib will then only re-read the token from the DOM on retry). Default: '/sanctum/csrf-cookie'.
OptionalheadersAdditional headers merged into every request
OptionalonCalled when a 401 session-expired response is received
vapor-chamber — HTTP client
Adapted and improved from useFetch (2026-02-05A). TypeScript rewrite aligned with vapor-chamber conventions and CDCC thresholds.
Improvements over the original:
anycasts)AbortSignal.anywith manual fallback for older environmentsX-RateLimit-Resetheader as Retry-After fallbacksession-expiredCustomEvent + configurable callbackTimeoutErrordistinct fromAbortError(user abort vs timeout)