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

#224: display OAuthAccountNotLinked error message + other errors messages #542

Merged
merged 2 commits into from
Jan 8, 2023

Conversation

callum-gander
Copy link
Contributor

I checked how NextAuth does it https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/core/pages/signin.tsx. They seem to pass the error in props somehow. I didn't want to add too much code or change the overall structure too much so I just added a useEffect to check whether the router contains an error. If it does, use a type guard to check if it's a string or an array, and handle them appropriately. I don't think there are cases when you'll get two errors at once, so it's mainly to stop TypeScript errors. I also added all the other error code from the above NextAuth page mentioned, so if other errors pop up they should be correctly displayed to the user. I also changed the error message for the OAuthAccountNotLinked as it didnt' seem to correctly reflect what we'd want the user to do, which is to login with the account they initially logged in with. I added the error message below the terms and conditions, I hope that's alright, obviously it can easily be moved elsewhere. I'm not sure whether you want the SignInErrorTypes and the errors object moved to a separate location? Other than this, any additional thoughts or does this satisfy the requirements?

@callum-gander
Copy link
Contributor Author

As a sidenote, I've ran the pre-commit's and everything is passing but it's not showing it as having been done on the pull request?

@Klotske
Copy link
Contributor

Klotske commented Jan 8, 2023

As a sidenote, I've ran the pre-commit's and everything is passing but it's not showing it as having been done on the pull request?

As I understand, running pre-commit locally is a way of testing your changes against different linters and format fixers. If it passed all is good.
But Github has pre-commit check too. It's not showing as "done" because first-time Contributors need a Collaborator's approval for running GH actions workflow.

@callum-gander
Copy link
Contributor Author

As I understand, running pre-commit locally is a way of testing your changes against different linters and format fixers. If it passed all is good. But Github has pre-commit check too. It's not showing as "done" because first-time Contributors need a Collaborator's approval for running GH actions workflow.

Ahhh I thought it might have something to do with that, perfect, thanks!

Copy link
Collaborator

@AbdBarho AbdBarho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Collaborator

@AbdBarho AbdBarho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants