Open dong77 opened 9 years ago
I take it you were working off of this example? https://erikringsmuth.github.io/app-router/#/events#polymer-event-mapping
The URL should really be the only conditional when routing. Otherwise you break REST. You could maybe put conditional templates in a page but that doesn't seem idea. I think the best way is to route to a separate URL like /login
if the user isn't logged in. You can do a redirect or replace the current URL with router.go()
https://erikringsmuth.github.io/app-router/#/api#go.
When the app needs to handle routing based on user session, it's good to have conditional app-route support so we can write someting like this:
Currently I have to rely on a on-state-change handler, but the UX is not ideal - the router first jumpted to one page then jump back to the page I directed.