How to fetch data from NextJs API folder using tanstack query on button click
Hello, so I'm using tanstack query (first time ever) to fetch a NextJS API route triggered by a button click that calls the Clerk Dev backend API to delete a user. The thing is, that sometimes the API's response is successful, sometimes it is not, and since I'm new with this library I don't know what I should do or where to start. Here is my code:


