useForm to create is using GET instead of POST or PUT
I have a simple form which uses the useForm hook to create one of my resources. It correctly finds the create route, but it arrives as a GET instead of a POST or PUT. Because I'm using remix, that means that the action method (which is what should be handling the POST) never gets called.
3 Replies
Hi @oshiri3676. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, the
useForm
hook in Refine is designed to handle create
, edit
, and clone
actions. By default, it determines the action
from the route. The action is inferred by matching the resource's action path with the current route. It can be overridden by passing the action
prop where it isn't possible to determine the action from the route.
For creating a new record, useForm
uses useCreate
under the hood for mutations on create mode. If you're experiencing issues with the HTTP method used, it might be related to your data provider or how you've configured your routes.
Here are some resources that might help you troubleshoot the issue:
- Refine's useForm documentation (https://refine.dev/docs/data/hooks/use-form/)
- Refine's useCreate documentation (https://refine.dev/docs/data/hooks/use-create/)
- Refine's guide on forms and router integration (https://refine.dev/docs/guides-concepts/forms#integration-with-routers)
If you're still having trouble, you might want to consider opening an issue on the Refine GitHub repository (https://github.com/refinedev/refine/issues).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@783439443410813008> kapa.ai is still learning and improving, please let us know how it did by reacting below
robust-apricot•8mo ago
Hello @oshiri3676 Could you please explain the issue in more detail for me? reproducible example will be awesome.