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

Users are redirected to the dashboard regardless of sign-up success on branch step/1 #8

Open
keplib opened this issue Dec 30, 2024 · 0 comments

Comments

@keplib
Copy link

keplib commented Dec 30, 2024

Hi,

I'm quite new to Next.js, so this might just be a question rather than an issue. However, I have some doubts about the implementation of the user registration in actions/auth.ts:

Screenshot 2024-12-30 at 19 48 29

From what I understand, it seems like users are redirected to the dashboard regardless of whether the sign-up was successful. I think this behavior might not be ideal, as it could result in users being redirected even if there was an error during registration.

My proposed solution would be:

  • Return {success: true} in the try block and {success: false} in the catch block to clearly indicate the outcome of the action.
Screenshot 2024-12-30 at 19 50 49
  • On the client side (in SignupForm.tsx), use useEffect and useRouter to redirect users to the dashboard only when the action response indicates success.
Screenshot 2024-12-30 at 19 49 32

I realize that this might be addressed later in the course, but I wanted to share my thoughts in case this is an oversight. If this is indeed acknowledged as an issue, what would the next steps be for fixing it?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant