Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

#224: display OAuthAccountNotLinked error message + other errors messages

Open callum-gander opened this issue 3 years ago • 3 comments

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 avatar Jan 08 '23 13:01 callum-gander

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?

callum-gander avatar Jan 08 '23 14:01 callum-gander

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.

Klotske avatar Jan 08 '23 14:01 Klotske

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!

callum-gander avatar Jan 08 '23 14:01 callum-gander