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'

See also