-
Hi there, simple login form with FormStrategy and React-Hook-Form. This is loader:
This is the error: Looks like we access the body of request twice...where am i wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
getValidatedFormData is reading the body to validate it, and Remix Auth is doing it again, you should clone the request when validating it, or validate inside the strategy callback. |
Beta Was this translation helpful? Give feedback.
-
Hi Sergio. Thank you for your answer. Well I am already doing that, passing cloned request object. But according to this: https://github.com/sergiodxa/remix-auth-form#passing-a-pre-read-formdata-object I we pass formData as part of optional context, we don't need to clone request... |
Beta Was this translation helpful? Give feedback.
The context property must be
formData
, not justdata
.Also is that
data
returned bygetValidatedFormData
aFormData
instance? or a plain object? You need to pass a FormData object.I recommend you to clone the request here
await getValidatedFormData<FormData>(request.clone(), resolver);
.