@toptal/davinci-cloudflare-requests-handler
Version:
Toptal Cloudflare requests handler
13 lines (9 loc) • 363 B
text/typescript
import { storageIsSupported } from './utils/local-storage'
import cloudflareFetchHander from './cloudflare-fetch-handler'
const fetchIsSupported = 'fetch' in window
if (fetchIsSupported && storageIsSupported('localStorage')) {
const nativeFetch = window.fetch
window.fetch = (...args) => {
return nativeFetch(...args).then(cloudflareFetchHander)
}
}