no-cache-fetch
Drop-in replacement for fetch on sensitive routes so permission checks cannot be satisfied from stale cached responses.
Behavior
- Appends
_t,_r,_ncquery params for uniqueness. - Merges aggressive no-cache headers (
Cache-Control,Pragma,Surrogate-Control, etc.). - Sets
cache: 'no-store'and defaultcredentials: 'include'.
Exports
noCacheFetch(input, init?)— Primary API.- Additional helpers in the same file mirror
fetchpatterns for GET/POST wrappers (see source).
Prefer this over raw fetch for auth, admin, and permission-dependent client calls.
Sources: src/lib/utils/no-cache-fetch.ts