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
I've got a normal login page and the <form>'s action points to /login. So when you run a GET you get the content from Next, and when you run a POST you should hit the /api/login.js.
I can add a redirect to Next via the next.config.js but can't currently see that it should be conditional based on the request type.
Is it possible?
Otherwise I can POST to /api/login, but if the user posted when JS didn't fully hook (or if it failed to download for whatever reason), I want to make sure the endpoint would redirect them to signed in (whereas a client-side sign in would only get the token back and to a client side redirect).
In the (g)olden days, I would have checked the xml-requested-with - but that seems… clunky compared to all the shiny tools we have…no?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a normal login page and the
<form>
's action points to/login
. So when you run aGET
you get the content from Next, and when you run aPOST
you should hit the/api/login.js
.I can add a redirect to Next via the
next.config.js
but can't currently see that it should be conditional based on the request type.Is it possible?
Otherwise I can
POST
to/api/login
, but if the user posted when JS didn't fully hook (or if it failed to download for whatever reason), I want to make sure the endpoint would redirect them to signed in (whereas a client-side sign in would only get the token back and to a client side redirect).In the (g)olden days, I would have checked the
xml-requested-with
- but that seems… clunky compared to all the shiny tools we have…no?Beta Was this translation helpful? Give feedback.
All reactions