Closed jonaskello closed 7 years ago
Thanks for your question! I could've used the context of the <OidcProvider />
as well - that's true. React's context API is subject to change however, so I use it sparingly. The import is guaranteed to always work.
Your idea of putting the signinRedirect
call into a saga is also valid. In a proper application you would put it in a saga like you suggested or have a separation between dumb components containing the HTML & CSS, accompanied by smart containers linking the components with behavior and call the signin function in the container. Both are equally valid.
The main reason for doing it this way is that I want to keep it simple and demonstrate the core features of redux-oidc
. It is by no means a styleguide on how to build redux apps and shouldn't be interpreted this way.
Thank you for the fast reply :-). I am currently trying to figure out where to put things that concern user management but I get now the example is not a guideline for that, it just demonstrates the capabilities of the lib.
Nice example!
One question about the loginPage. Why does it get the UserManager by
import userManager from '../../utils/userManager';
instead of getting it from the context?Also curious if you have you considered having the login page just doing an action like
REQUEST_LOGIN
and doing theuserManager.signinRedirect();
part in a saga instead? This way the loginPage component does not have to know about userManager, and the side-effects are kept in the saga.