-
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
Return User Info from Login Endpoint #136
Conversation
e55f202
to
253bfc8
Compare
Taking a look now. |
253bfc8
to
1f7fb35
Compare
For some reason the linter integration with my VSCode isn't working, leading to all the linting errors. 9552480 should be the last fix that takes care of it. |
One thing quickly, since I know you're online. With this PR we now lose the ability to keep the user logged in after refresh, i.e. when we lose redux state. I don't know if our usual approach is to persist the redux state, or to tolerate more API calls, or to just tolerate logging the user out. |
Nice catch! Had missed saving the user state in PrivateRoute. Fixed in 33930fe |
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.
Tested, works great!
The State serializer is very minimal, fits its current purpose. Other more detailed serializers may be added in the future.
When fetching an already logged in user, or logging in a new user, always return the user's email, role, and utilities. This will be used to inform the front-end about various decisions.
Now that the API returns a user object with details, we store the whole thing in Redux, and switch away from signedIn: true as the signifier for login state.
Now that the login endpoint gives us the user's utilities, we use those instead of the placeholders in the UI. Also update the redux logic to match the back-end utility data structure.
33930fe
to
638859e
Compare
Thanks for reviewing! |
Overview
Returns user details from the login endpoint. Both when logging in a new user, and when fetching an already logged in user, we return details about the user, which include their email, Role, and list of Utilities.
Adds a Utility and State serializer along the way. Updates front-end redux arrangement to consume the new user object for login state management. Also uses the user's list of utilities to correctly render the Nav Bar.
Closes #123
Demo
Testing Instructions
server
Checklist
fixup!
commits have been squashedCHANGELOG.md
updated with summary of features or fixes, following Keep a Changelog guidelinesREADME.md
updated if necessary to reflect the changes