{"action":"created","issue":{"url":"https://api.github.com/repos/kadirahq/mantra/issues/89","repository_url":"https://api.github.com/repos/kadirahq/mantra","labels_url":"https://api.github.com/repos/kadirahq/mantra/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/mantra/issues/89/comments","events_url":"https://api.github.com/repos/kadirahq/mantra/issues/89/events","html_url":"https://github.com/kadirahq/mantra/issues/89","id":134666274,"number":89,"title":"Authorization logic in components / router","user":{"login":"adamdawkins","id":27672,"avatar_url":"https://avatars.githubusercontent.com/u/27672?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdawkins","html_url":"https://github.com/adamdawkins","followers_url":"https://api.github.com/users/adamdawkins/followers","following_url":"https://api.github.com/users/adamdawkins/following{/other_user}","gists_url":"https://api.github.com/users/adamdawkins/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdawkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdawkins/subscriptions","organizations_url":"https://api.github.com/users/adamdawkins/orgs","repos_url":"https://api.github.com/users/adamdawkins/repos","events_url":"https://api.github.com/users/adamdawkins/events{/privacy}","received_events_url":"https://api.github.com/users/adamdawkins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2016-02-18T19:07:04Z","updated_at":"2016-02-28T01:02:04Z","closed_at":null,"body":"I've put my authorization logic in an action, which I call in the composer, as per #62, #65.\r\n\r\nThe strangest thing is happening though, the URL is changing to '/login', but the 'feed' component is still rendering.\r\n\r\nIs this an 'order' thing? Do I need to 'stop' something?\r\n\r\n```\r\n  authorize({Meteor, LocalState, FlowRouter}) {\r\n    if (!Meteor.userId()) {\r\n      LocalState.set('LOGIN_ERROR', 'You must be logged in to go to that page');\r\n      return FlowRouter.go('/login');\r\n    }\r\n  }\r\n```\r\n\r\n```\r\nexport const composer = ({context, authorize}, onData) => {\r\n  const {Meteor, Collections} = context();\r\n  authorize();\r\n\r\n  if (Meteor.subscribe('tweets.all').ready()) {\r\n    const tweets = Collections.Tweets.find({}, {\r\n      sort: {createdAt: -1}\r\n    }).fetch();\r\n    onData(null, {tweets});\r\n  }\r\n\r\n};\r\n\r\nexport const depsMapper = (context, actions) => ({\r\n  authorize: actions.users.authorize,\r\n  context: () => context\r\n});\r\n```\r\n\r\nThe repo is here: https://github.com/adamdawkins/mantra-twitter/commit/17aed61eea791936c445ad7977ae4f49f066dde7\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kadirahq/mantra/issues/comments/189755654","html_url":"https://github.com/kadirahq/mantra/issues/89#issuecomment-189755654","issue_url":"https://api.github.com/repos/kadirahq/mantra/issues/89","id":189755654,"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":"2016-02-28T01:02:04Z","updated_at":"2016-02-28T01:02:04Z","body":"@fallenpeace you could do it. But I would like to apps to show a link to the login page rather redirecting him to the login page. It's a good UX pattern and works best for us."}}