Closed Hopding closed 7 years ago
This PR has a lot in common with #464. Is there functionality added here that is not there?
@dane-johnson It does. #464 does not remove the app's usage of cookies for storing user data. This PR goes. Look specifically at the changes made to components/Auth.jsx
and containers/CodesplainAppBar.jsx
.
Description
This PR moves the storage location of certain user data (such as their username, avatarURL, & orgs) from cookies to the redux state. This resolves the problems we have had with stale data, as it causes the data to be updated every time the UI is loaded. The only data that is being stored in a cookie, now, is the user's
token
(and thesignInState
&signInRedirect
). The<CodesplainAppBar />
component is in charge of loading thetoken
cookie and updating the redux state with the user's info for use by the other components.Motivation and Context
Fixes #447. Prior to this change, we already held some of this information in redux, but not all of it, and we still kept the data in the cookies as well. This resulted in problems with stale data, as certain information (e.g. the user's organizations) was only updated when they logged in.
Checklist: