@@ -61,15 +61,15 @@ export function {{ method.hookName -}}<TData = {{ method.shortReturnType }}, {{
6161 return useMutation<{{ method.shortReturnType }}, TError, {{ method.shortInputType }}, TContext>({
6262 mutationFn: ({% if not method.isVoidShortInputType %}content{% endif %}) => {{ configuredGroupVar -}}.{{- controller.fieldName -}}.{{- method.methodName -}}({% if method.isVoidShortInputType %} {} {% else %} content {% endif %}),
6363 {% if method.invalidateKeysPrepared('content.', 'data.') is not empty %}
64- onSuccess: async (data, content , context) => {
64+ onSuccess: async (data, variables{% if reactQueryVersion.number >= 5 %}, onMutateResult{% endif %} , context) => {
6565 const invalide = async () => await Promise.all([{% for ik in method.invalidateKeysPrepared('content.', 'data.') %}
6666 queryClient.invalidateQueries(
6767 {% if reactQueryVersion.name equals "v5" %}{queryKey: [{% for k in ik %}`{{ k }}`{% if not loop.last %}, {% endif %}{% endfor %}]}
6868 {% else %}[{% for k in ik %}`{{ k }}`{% if not loop.last %}, {% endif %}{% endfor %}]{% endif %}
6969 ){% if not loop.last %}, {% endif %}{% endfor %}]);
7070
7171 if (onSuccess) {
72- const result = onSuccess(data, content , context);
72+ const result = onSuccess(data, variables{% if reactQueryVersion.number >= 5 %}, onMutateResult{% endif %} , context);
7373 if (result && Object.prototype.toString.call(result) === "[object Promise]") {
7474 await result;
7575 return invalide();
0 commit comments