I have api call that looks like
const getMutationService = () => {
return {
createMeme: async (
_private: string,
templateId: string,
file: Blob,
memeText?: string,
title?: string,
tags?: Array<string>,
): Promise<MemeCreateMemeResponse | undefined> => {
return await memeApi.memePost({
_private,
templateId,
file,
memeText,
title,
tags,
});
},
};
};
and I am calling this in another hook like
const mutationService = getMutationService();
const { mutate: createMeme } = useMutation(mutationService.createMeme);
Its throwing an error of
Argument of type '(_private: string, templateId: string, file: Blob, memeText?: string, title?: string, tags?: Array) => Promise<MemeCreateMemeResponse | undefined>' is not assignable to parameter of type 'MutationKey'.
I have done other mutation calls with the same pattern. Why is this one throwing this mutation key error? Confused