Skip to content

@deltares/fews-web-oc-composables


@deltares/fews-web-oc-composables / provideHostWebserviceContext

Function: provideHostWebserviceContext() ​

provideHostWebserviceContext(context): void

Defined in: shared/hostWebserviceContext.ts:42

Beta

Provides the host webservice context, making it available to micro-frontends via useHostWebserviceContext.

Must be called by the host application before any micro-frontend that relies on the host-provided webservice configuration is mounted.

Parameters ​

context ​

HostWebserviceContext

The webservice context to provide.

Returns ​

void

Example ​

ts
// Host application bootstrap
import { provideHostWebserviceContext } from '@deltares/fews-web-oc-composables'

provideHostWebserviceContext({
  getBaseUrl: () => 'https://example.localhost/fewswebservices',
  getAuthorizationHeaders: async () => {
    const headers = new Headers()
    headers.set('Authorization', `Bearer ${await getAccessToken()}`)
    return headers
  },
})