Reads the site's variables, the named values (a phone number, an opening status) defined once
in the admin, available as lynkow.variables. Read-only. With cache: true,
responses are cached for 5 minutes.
Access via: lynkow.variables
Methods
1 method
list
list(options?: BaseRequestOptions): Promise<SiteVariableList>Fetches every variable of the site, one per key, sorted by key and not paginated. Without a locale, each
value is served in the site's default locale. With one, a key with no value in that locale is served from the
fallback locale and flagged isFallback: true: pass fallback: false to drop those keys. With cache: true, cached for 5 minutes.
Resolves to an empty data array when the site has no variables.
Throws LynkowError NOT_FOUND for an unknown site, FORBIDDEN for an inactive site
or a request origin that does not match the site's domain, and PAYMENT_REQUIRED when the
subscription no longer covers public delivery.
Parameter | Type | Description |
|---|---|---|
|
| Request options. |
Returns: Promise<SiteVariableList>
const { data: variables } = await lynkow.variables.list({ locale: 'fr' })
// A footer status indicator driven by a `status` variable.
const status = variables.find((v) => v.key === 'status')?.value ?? 'ok'