Skip to content
Discussion options

You must be logged in to vote

You can either:

  • Define vars in the mutation parameter and pass them each time you call the mutate or mutateAsync method: Playground

    import { defineMutation } from "@pinia/colada";
    
    const useMutateThing = defineMutation({
      mutation: (vars: { id: string; name?: string; status?: "yes" | "no" }) =>
        Promise.resolve(),
    });
    
    const { mutateAsync: mutateThing } = useMutateThing();
    await mutateThing({ id: "one", status: "no" });
  • Just don't use defineMutation: Playground

    import { useMutation } from "@pinia/colada";
    
    const useMutateThing = (id: string) => useMutation({
      mutation: (vars: { name?: string; status?: "yes" | "no" }) =>
        Promise.resolve(),
    });
    
    const { mutateAsync: mutateThing } 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@posva
Comment options

@amandesai01
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants