{"action":"created","issue":{"url":"https://api.github.com/repos/kadirahq/flow-router/issues/248","labels_url":"https://api.github.com/repos/kadirahq/flow-router/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/flow-router/issues/248/comments","events_url":"https://api.github.com/repos/kadirahq/flow-router/issues/248/events","html_url":"https://github.com/kadirahq/flow-router/issues/248","id":98826084,"number":248,"title":"[Question] Meteor.user() availability inside route action?","user":{"login":"voidale","id":4450730,"avatar_url":"https://avatars.githubusercontent.com/u/4450730?v=3","gravatar_id":"","url":"https://api.github.com/users/voidale","html_url":"https://github.com/voidale","followers_url":"https://api.github.com/users/voidale/followers","following_url":"https://api.github.com/users/voidale/following{/other_user}","gists_url":"https://api.github.com/users/voidale/gists{/gist_id}","starred_url":"https://api.github.com/users/voidale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voidale/subscriptions","organizations_url":"https://api.github.com/users/voidale/orgs","repos_url":"https://api.github.com/users/voidale/repos","events_url":"https://api.github.com/users/voidale/events{/privacy}","received_events_url":"https://api.github.com/users/voidale/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-03T19:53:24Z","updated_at":"2015-08-04T04:02:31Z","closed_at":null,"body":"Hi Arunoda,\r\n\r\nI wanted to ask you about the best practice about the following it's a little bit tricky:\r\nI'm keeping a current selected profile inside `Meteor.user().profile.currentProfile` and when the user comes to my app I want to redirect him to the page with that profile.\r\n\r\n* those routes are always with a user logged in, But Meteor.user() can be unavailable what if it's in the middle of the loggingIn. The router shouldn't wait for anything isn't that correct? \r\n* I don't want to use fast-render to get Meteor.user() availability how about an alternative? :)\r\n\r\n````\r\nFlowRouter.route('/', {\r\n  name: 'home',\r\n  action: function(params, queryParams) {\r\n    // Problem\r\n    var user = Meteor.user();\r\n    FlowRouter.go('profile/'+user.profile.currentProfile+'/content'); \r\n  }\r\n});\r\n\r\n\r\nFlowRouter.route('/profile/:profileId/content', {\r\n  name: 'content',\r\n  action: function(params, queryParams) {\r\n    // Inside that template I use the FlowRouter.getParam to subscribe to the right profile\r\n    BlazeLayout.render('layout', {main: \"content\"});\r\n  }\r\n});\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/kadirahq/flow-router/issues/comments/127471346","html_url":"https://github.com/kadirahq/flow-router/issues/248#issuecomment-127471346","issue_url":"https://api.github.com/repos/kadirahq/flow-router/issues/248","id":127471346,"user":{"login":"arunoda","id":50838,"avatar_url":"https://avatars.githubusercontent.com/u/50838?v=3","gravatar_id":"","url":"https://api.github.com/users/arunoda","html_url":"https://github.com/arunoda","followers_url":"https://api.github.com/users/arunoda/followers","following_url":"https://api.github.com/users/arunoda/following{/other_user}","gists_url":"https://api.github.com/users/arunoda/gists{/gist_id}","starred_url":"https://api.github.com/users/arunoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunoda/subscriptions","organizations_url":"https://api.github.com/users/arunoda/orgs","repos_url":"https://api.github.com/users/arunoda/repos","events_url":"https://api.github.com/users/arunoda/events{/privacy}","received_events_url":"https://api.github.com/users/arunoda/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T04:02:31Z","updated_at":"2015-08-04T04:02:31Z","body":"Check this article on how to deal with auth logic: https://kadira.io/academy/meteor-routing-guide/content/implementing-auth-logic-and-permissions"}}