Skip to content

Commit

Permalink
refactor: fix return type onSettled
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Mar 16, 2024
1 parent ee9367f commit bbcbf24
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/use-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface UseMutationOptions<
/**
* Hook to execute a callback in case of error
*/
onSettled?: (context: { data: TResult | undefined, error: TError | null, args: TParams, context: TContext }) => void
onSettled?: (context: { data: TResult | undefined, error: TError | null, args: TParams, context: TContext }) => unknown

// TODO: invalidate options exact, refetch, etc
}
Expand Down Expand Up @@ -158,14 +158,12 @@ export function useMutation<
status.value = 'pending'
}

const mutationReturn = {
return {
data,
isLoading: computed(() => status.value === 'loading'),
status,
error,
mutate,
reset,
} satisfies UseMutationReturn<TResult, TParams, TError>

return mutationReturn
}
}

0 comments on commit bbcbf24

Please sign in to comment.