[Vuejs]-Perform PUT/PATCH request with @tanstack/vue-query

0👍

I got the same kind of error when trying this kind of situation. what helped removing this error was typeing the argument of the mutation function so in my example it was like this:

mutationFn: async (input) => {
return await fetch(props.apiPath, { method: "PUT", body: JSON.stringify(input) }).then((res) =>
  res.json()
);

But when i updated it to this:

mutationFn: async (input) => {
    return await fetch(props.apiPath, { method: "PUT", body: JSON.stringify(input) }).then((res) =>
      res.json()
    );

the error was gone & the function was running as expected. Hope this helps

Leave a comment