Skip to content

delete item issue is solved: remove body from delete query #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sk-Azraf-Sami
Copy link

Fix: Remove body from DELETE request in deleteTodo mutation

Problem

The previous implementation of the deleteTodo mutation included a body in the DELETE request:

deleteTodo: builder.mutation({
  query: ({ id }) => ({
    url: `/todos/${id}`,
    method: 'DELETE',
    body: id
  }),
  invalidatesTags: ['Todos']
}),

Including a body in a DELETE request caused the API to fail to delete items from the todo list. As a result, the delete operation did not work as expected.
A video demonstrating this issue is attached.

Solution

This PR removes the unnecessary body property from the DELETE request:

deleteTodo: builder.mutation({
  query: ({ id }) => ({
    url: `/todos/${id}`,
    method: 'DELETE',
  }),
  invalidatesTags: ['Todos']
}),

Impact

  • The delete operation now works correctly, and todos can be deleted as expected.
  • No breaking changes to other endpoints.

Additional Info

  • Video attached showing the issue before this fix.
bug-demonstration.mp4

Tested: Manually tested delete functionality after the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant