Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to page when login is successful #8

Open
brandonvilla21 opened this issue Apr 4, 2019 · 1 comment
Open

Redirect to page when login is successful #8

brandonvilla21 opened this issue Apr 4, 2019 · 1 comment
Assignees
Labels
feature good first issue Good for newcomers

Comments

@brandonvilla21
Copy link
Owner

Redirect in Next.js is different than a conventional React applicacion with React router. Here are some resources:

  1. The ideal workflow would be to let the Login page know when the LoginForm has submitted the information and has a response (error or success)

  2. You will need to create the page that you want to redirect (maybe we need to discuss this as a team to what page will be the initial page once the user logs in)

@Aravin
Copy link

Aravin commented Dec 20, 2020

I got the same error.

I am surprised to see there is no proper way to redirect from login page -> my account page after successful authentication.

Error Message:

error Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

Code Example

..
var provider = new firebase.auth.FacebookAuthProvider();
  auth.signInWithPopup(provider).then(function(result) {
    // The signed-in user info.
    var user = result.user;
    useRouter().replace('/account');
    // ...
  }).catch(function(error) {
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants