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.

RpcMutation

interfaz Since 1.1.0

Resultado de useRpcMutation(procedimiento): llama al procedimiento bajo demanda con mutate, nunca en SSR, y refleja la última llamada en pending, data y error. Con la opción retrySafe añade RetrySafeMutation (desde 1.2).

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

Source code src/app/composables/resources/engine.ts:162

Declaración #

ts
interface RpcMutation<Input, Output> {
	mutate(input: Input): Promise<Output>
	readonly pending: ReadonlySignal<boolean>
	readonly error: ReadonlySignal<Error | null>
	readonly data: ReadonlySignal<Output | null>
}

Type parameters #

Input

Entrada del procedimiento.

Output

Salida del procedimiento.

Example #

meeko
<script lang="ts">
const rename = useRpcMutation("users.rename");
async function save(): Promise<void> {
  await rename.mutate({ id: "1", name: "Ada" });
}
</script>
<template><button bind:disabled="rename.pending.value" on:click="save">Guardar</button></template>

Miembros #

mutate #

método

mutate(input: Input): Promise<Output>

Llama al procedimiento con el token CSRF; devuelve su salida o rechaza con su error.

pending #

propiedad sólo lectura

readonly pending: ReadonlySignal<boolean>

true mientras una llamada está en curso.

error #

propiedad sólo lectura

readonly error: ReadonlySignal<Error | null>

Fallo de la última llamada, o null.

data #

propiedad sólo lectura

readonly data: ReadonlySignal<Output | null>

Salida de la última llamada correcta, o null.

See also #

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/app/composables/resources/engine.ts