Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

ClientOptions

interfaz

Opciones de transporte de los clientes de API y RPC y de los composables de datos. Las que aceptan una función la evalúan en cada petición.

ts
import type { ClientOptions } from "@meekojs/meeko/framework";

Source code src/shared/clients.ts:409

Declaración #

ts
interface ClientOptions {
	readonly baseUrl?: string | (() => string)
	readonly fetch?: typeof fetch
	readonly credentials?: RequestCredentials
	readonly csrfToken?: string | (() => string | undefined)
	readonly headers?: HeadersInit | (() => HeadersInit)
}

Example #

ts
import { createApiClient } from "@meekojs/meeko/framework";
import type { ClientOptions } from "@meekojs/meeko/framework";

const options: ClientOptions = {
  baseUrl: "https://example.com",
  headers: () => ({ authorization: `Bearer ${localStorage.getItem("token") ?? ""}` }),
};
const api = createApiClient(manifest, options);

Propiedades #

baseUrl #

propiedad sólo lectura opcional

readonly baseUrl?: string | (() => string)

Origen o URL base contra la que se resuelven las rutas; sin él, rutas relativas.

fetch #

propiedad sólo lectura opcional

readonly fetch?: typeof fetch

Implementación de fetch; por defecto, la global.

credentials #

propiedad sólo lectura opcional

readonly credentials?: RequestCredentials

Credenciales de fetch; por defecto, same-origin.

csrfToken #

propiedad sólo lectura opcional

readonly csrfToken?: string | (() => string | undefined)

Token CSRF que se envía en x-meeko-csrf en los métodos distintos de GET y HEAD.

headers #

propiedad sólo lectura opcional

readonly headers?: HeadersInit | (() => HeadersInit)

Cabeceras adicionales de cada petición.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/shared/clients.ts