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:
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.
- On the client side (in
SignupForm.tsx), use useEffect and useRouter to redirect users to the dashboard only when the action response indicates success.
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!
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: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:
{success: true}in the try block and{success: false}in the catch block to clearly indicate the outcome of the action.SignupForm.tsx), useuseEffectanduseRouterto redirect users to the dashboard only when the action response indicates success.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!