Conversation
|
@adamjarling - I added skip to one JS test as I wasn't sure how best to address. |
adamjarling
left a comment
There was a problem hiding this comment.
All in all I think this is really good (from the React side) and works as expected. I'd like to merge this in, then take a crack at building off this branch with the following strategy for protected routes, and globally exposing a currentUser object w/o Redux.
<Auth /> component wraps the app, similar to <RequireSignIn />, and uses/sets/reads a React Context auth/currentUser variable which can be accessed throughout the app.
assets/js/components/CurrentUser.js
Outdated
| }; | ||
|
|
||
| export default CurrentUser; | ||
| export { GET_CURRENT_USER_QUERY }; |
There was a problem hiding this comment.
What about creating a /assets/js/components/Auth directory, where we can organize Auth related components (CurrentUser, RequireSignIn) and queries? Then we could create .../Auth/auth.query.js or something and avoid exporting from individual components?
There was a problem hiding this comment.
Yeah. I think that's a good idea. Some of that stuff didn't seem to fit anywhere so I just threw it somewhere. Let me see if BMQ and MBK have comments and I'll change at same time.
| import ContentWrapper from "../components/UI/ContentWrapper"; | ||
|
|
||
| const redirectToLogin = event => { | ||
| event.preventDefault; |
There was a problem hiding this comment.
Might not need this if not a link or form submit action.
mbklein
left a comment
There was a problem hiding this comment.
Looks great except for one small comment.
Authenticatewhich checks for the current user in the context and if found resolves the query.**Authorization was out of scope for this unit of work. For this PR anyone with a NetId can log in and use Meadow.