Skip to content

Fix redirect on login

Loic Huder requested to merge redirect-login into main

Fix #47 (closed)

There was already a redirect on submission of the credentials but it was overwritten by an explicit redirect to / in updateUser. I removed the redirect on submission and change the redirect in updateUser to the actual from location.

Note: I could not do it the other way round by only removing the redirect in updateUser. If I do it this way, there is a bug that force the user to click twice on the Log in button.

My guess is that in this case, the updateUser changes the state which makes the component rerender before the history.replace(from) that comes after, making the user stay on the login page. A second press with the same credentials does not update the state (as the token is already set) which prevents the rerender and allows the history.replace(from) to go through. But that is another story.

Edited by Loic Huder

Merge request reports