You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am making this an issue instead of pull request until an idiomatic way of doing this is agreed upon.
The idea is that if a user has JS disabled, React renders a url-encoded form instead of an ajax powered one. Without the modification to fetchr linked below, the form does not redirect to the referrer when url-encoded form submission occurs so the json response is all the user would see. Instead, I have added a redirect to referrer.
I think that modifying the middleware function of fetchr is a bit of a hack. A proper solution would let the "user" decide to implement a redirect inside of the Service callback. However, I wanted to check with you over whether adding the res object to the callback args is the right way to proceed or if middleware modification is actually the best place to detect url-encoded form submission.
I also think that requiring a redirectUrl by convention to the React form might be necessary instead of redirecting to 'back'.
Thanks,
-Chris
The text was updated successfully, but these errors were encountered:
@cmgriffing I think the best way to handle this would be to support internal fetchr middleware. Something along the lines of #61. That way you can get increased app specific customization (e.g. limiting form redirect logic to only a few resources, adding authentication to other resources) while still keeping fetchr generic.
I'm going to close this issue. You can tack #61 for progress on custom middleware.
Hi, I am making this an issue instead of pull request until an idiomatic way of doing this is agreed upon.
The idea is that if a user has JS disabled, React renders a url-encoded form instead of an ajax powered one. Without the modification to fetchr linked below, the form does not redirect to the referrer when url-encoded form submission occurs so the json response is all the user would see. Instead, I have added a redirect to referrer.
Here is the commit in question (on my fork): cmgriffing@0f7dcc5
It simply detects a urlencoded form and redirects back to the referrer url.
This is in relation to proof of concept code here: cmgriffing/isomorphic-porch-demo@ef28c23
I think that modifying the middleware function of fetchr is a bit of a hack. A proper solution would let the "user" decide to implement a redirect inside of the Service callback. However, I wanted to check with you over whether adding the res object to the callback args is the right way to proceed or if middleware modification is actually the best place to detect url-encoded form submission.
I also think that requiring a redirectUrl by convention to the React form might be necessary instead of redirecting to 'back'.
Thanks,
-Chris
The text was updated successfully, but these errors were encountered: