-
Notifications
You must be signed in to change notification settings - Fork 3
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
Sdk6toast #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the toast shows up all the time, but it should only show up on HomePage right after a login. Similarly, it should take you back to LoginPage and play a toast with an error if the login fails. Check my other comment for details.
web/src/pages/HomePage/HomePage.jsx
Outdated
import { useAuth } from 'src/auth' | ||
|
||
const HomePage = () => { | ||
const { currentUser, isAuthenticated } = useAuth() | ||
|
||
toast.success(`Login successful, welcome ${currentUser.email}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the toast is always played whenever a user visits that page. This means any time they refresh they will see the same toast. We only want it to happen right after they log in. Check this example for creating a dynamic toast, and the ability to add more readable error messages to oauth.js: https://redwoodjs.com/docs/how-to/oauth#better-error-handling
i changed to show toast on the first login but im not sure how a google login fails, wouldnt they just automatically go back to login? I am going to sleep now but am happy to talk more about this later. |
What you have there looks great for showing the message on first login! As for showing login errors, you are right. Most of the login errors are caught by Google. But we get some of them. Look in /api/src/functions/oauth/oauth.js Both of these catch potential errors with the login. They currently just return an error message, but you should make them redirect back to routes.login() and show a toast with that error message. Session is a good solution for homepage, but in this case you'll want a customizable method so I would recommend doing it with query string parameters as shown in the link I sent above. |
Merged as part of #15 I think |
No description provided.