httpHeaders

Environment: client.

Send additional HTTP headers to be sent along Telefunc HTTP requests.

Usually used for sending authentication headers.

// Environment: client

import { config } from 'telefunc/client'

config.httpHeaders = {
  Authorization: `Bearer ${token}`
}

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