API Documentation / @pinia/colada / UseMutationReturn
Interface: UseMutationReturn<TData, TVars, TError> 
Type Parameters 
TData 
TData
TVars 
TVars
TError 
TError
Properties 
asyncStatus 
asyncStatus: ShallowRef<AsyncStatus>;Status of the mutation. Becomes 'loading' while the mutation is being fetched, is 'idle' otherwise.
data 
data: ShallowRef<undefined | TData>;The result of the mutation. undefined if the mutation has not been called yet.
error 
error: ShallowRef<null | TError>;The error of the mutation. null if the mutation has not been called yet or if it was successful.
isLoading 
isLoading: ComputedRef<boolean>;Whether the mutation is currently executing.
key? 
optional key: 
  | EntryKey
  | (vars) => EntryKey;mutate() 
mutate: (...args) => void;Calls the mutation without returning a promise to avoid unhandled promise rejections.
Parameters 
args 
...unknown extends TVars ? [] : [TVars]
parameters to pass to the mutation
Returns 
void
mutateAsync 
mutateAsync: unknown extends TVars ? () => Promise<TData> : (vars) => Promise<TData>;Calls the mutation and returns a promise with the result.
Param 
parameters to pass to the mutation
reset() 
reset: () => void;Resets the state of the mutation to its initial state.
Returns 
void
state 
state: ComputedRef<DataState<TData, TError>>;The combined state of the mutation. Contains its data, error, and status. It enables type narrowing based on the ['status'].
status 
status: ShallowRef<DataStateStatus>;The status of the mutation.
See 
variables 
variables: ShallowRef<undefined | TVars>;The variables passed to the mutation. They are initially undefined and change every time the mutation is called.