-
Notifications
You must be signed in to change notification settings - Fork 240
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
v2 onEnter with FailureComponent #206
Comments
@dlong500 Sorry for the delay. So in v1, Does that make sense? |
But if In any case, I'll play around with it soon and let you know if I run into any problems with structuring it how you suggested first before I make things any more complicated. |
Im no SSR expert, but my understanding is the onEnter is used just for redirection, if you pass down a store on the server that causes the Failure component condition to trip then the initial render should still send down the Failure component. (It's still an HOC so both should be there). My main point though is that your previous v1 example didn't use the onEnter for admin either. The onEnter didnt do anything when a failure component was set. So this should keep the existing behavior. |
I think I understand now. If In any case, it might be nice to have a bit more documentation/examples to clarify this, as it only became clear to me once I realized that |
I agree that it would be great to improve the docs, do you want to take a stab at a PR? |
I'm trying to migrate from v1 to v2 of redux-auth-wrapper. I'm sticking with RR3 for the moment since I'm using SSR and it will be a larger undertaking to migrate everything to RR4 (though I do want to migrate eventually).
That being said, I'm running into some issues with getting everything working like it was under v1. To summarize, I'm not sure how to get a FailureComponent working under v2 and still support SSR with onEnter, as it appears
createOnEnter
only supports redirect actions. I might just be overlooking something simple, so I'd love some feedback since there isn't any documentation for precisely my type of scenario.Here's some of my original v1 code utilizing wrappers for
UserIsAuthenticated
andUserIsAdmin
(note thatUserisAuthenticated
redirects on failure, whileUserIsAdmin
displays a FailureComponent:And here's what I've got so far with v2, though obviously it will redirect if a user doesn't have admin rights instead of displaying a FailureComponent:
The text was updated successfully, but these errors were encountered: