Ember.js - Can the root url link to two routes, one for authenticated users and one for guests? -
is possible root path, example.com
, display landing page(application/index
) not logged in users profile page (users/show
) users logged in?
guest user -> example.com -> application/index authenticated user -> example.com -> users/show
i know goes against ember's philosophy of app state being reflected url, still, know if/how situation possible?
cheers!
yes, can it. firstly, should check user logged in or not in "beforemodel" of "application" route. if user logged in transits "profile" page using "transitionto" method otherwise transits "login" page.
beforemodel: function(transition) { var user; //put here method check if user logged in or not if (!user) { //if no user transist login this.transitionto('login'); } else { //other wise profile page this.transitionto('profilepage'); } }
Comments
Post a Comment