Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
fetch | Telefunc
[go: Go Back, main page]

Edit

fetch

Environment: client.

You can specify the fetch function that Telefunc uses for making HTTP requests on the client side.

This is useful for customizing the request and response behavior.

// Environment: client
 
import { config } from 'telefunc/client'
import { customFetch } from '../path/to/custom-fetch'
 
config.fetch = customFetch

You can define client-side configs (import { config } from 'telefunc/client') anywhere, just make sure to do it at global client-side code that is always executed. For example /pages/+client.js if you use Vike:

// /pages/+client.js
// Environment: client
 
import { config } from 'telefunc/client'
 
// Config values can be set here
config.someClientSideSetting = 'some-value'
// /pages/+client.ts
// Environment: client
 
import { config } from 'telefunc/client'
 
// Config values can be set here
config.someClientSideSetting = 'some-value'

See also