-
When I pass in arguments to a composable created using export const useUpdateInputMapping = defineMutation(uploadTab => {
const { errorToast, successToast } = useBvToast();
const {
isLoading: isSavingInputMapping,
mutateAsync: saveInputMapping,
...mutation
} = useMutation({
mutation: inputMapping =>
uploadTab.value.input_mappings?.[0]?.hash
? api.bidTool.inputMappings(uploadTab.value.input_mappings[0].hash).update(inputMapping)
: api.bidTool.uploadTabs(uploadTab.hash).inputMappings.store(inputMapping),
onSuccess() {
successToast('Input mapping saved successfully');
},
onError(error) {
console.error('Error saving input mapping:', error);
errorToast('Error saving input mapping');
},
});
return {
...mutation,
isSavingInputMapping,
saveInputMapping,
};
}); In the above case, when I call |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
defineMutation()
doesn't define a composable, it defines a singleton. In your case, you need a composable, so remove thedefineMutation()
and export the function directly.