-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Accommodate state in Router model #103
Comments
There was some discussion in the gitter chat room a while back about this. It'll probably be best to ask there because I don't use stateful routes myself. But the answer I remember giving there was to use dynamic routes. There's detail and some examples in |
@gehnaphore this may help: #100 |
Btw thank you and I'm happy to hear it :) |
Ok my brain learned to see this situation in a way that convinces me to entwine the Router and arbitrary state. (#107) This is issue is accepted. In the next release (a few weeks away) the Router will change to accommodate this. |
Great to hear it, and excited to see what you come up with. I started trying to figure out a better way of routing, and ended up researching Macro Paradise... and then deciding this problem didn't need to be solved immediately. :-) |
Closed via 93bbc5f. There's a new Router coming in 0.9 that fixes this. Routing rules can now be as stateful as you like, here's a small example. |
First of all, thanks for such an interesting library. I'm having a lot of fun with it.
I'm trying to use the router component, but having some trouble. I'm building a single-page app, and I'm looking for some way to properly route the user based on global state. For example, if the user is not logged in, I'd like to direct them to a login page. Since in a single-page app this is all managed with client-side state, I'm looking for some way to redirect based on app state. But redirection doesn't seem to allow any state-based decisions.
I feel like I'm missing something. How would I, say, redirect a non-logged-in user (based on reference to JS local storage or some other local state) to a login page? I can substitute components, but I don't see how I could actually perform a redirect.
The text was updated successfully, but these errors were encountered: